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 7fb1863
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 7fb1863

Please sign in to comment.