Skip to content

Commit

Permalink
Close renderer headless browser in finally block.
Browse files Browse the repository at this point in the history
Prevent zombie browser processes when creating the PDF fails by moving browser.close() to a finally block of the try/catch.

Closes #8979.
  • Loading branch information
fniessink committed Jun 14, 2024
1 parent ba8c7ae commit 15de628
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion components/renderer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@ app.get("/api/render", async (req, res) => {
}
});
console.log(`URL ${url}: PDF created`);
await browser.close();
res.contentType("application/pdf");
res.send(pdf);
} catch (error) {
console.error(error)
res.sendStatus(500)
} finally {
await browser.close()
}
})

Expand Down
3 changes: 2 additions & 1 deletion docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ If your currently installed *Quality-time* version is not v5.13.0, please first
### Fixed

- In the dropdown of the "Add metric" button, keep the two checkboxes next to each other regardless of the width of the menu. Fixes [#8745](https://github.com/ICTU/quality-time/issues/8745).
- The icon of the trend graph tab would not be shown. Closes [#8822](https://github.com/ICTU/quality-time/issues/8822).
- The icon of the trend graph tab would not be shown. Fixes [#8822](https://github.com/ICTU/quality-time/issues/8822).
- Prevent zombie browser processes in the renderer component when creating PDF fails by closing the browser regardless of whether generating the PDF succeeds or not. Fixes [#8979](https://github.com/ICTU/quality-time/issues/8979).

### Added

Expand Down

0 comments on commit 15de628

Please sign in to comment.