jasonraimondi / url-to-png

Selfhosted. URL to PNG utility featuring parallel rendering using Playwright for screenshots and with storage caching via Local, S3, or CouchDB
https://jasonraimondi.github.io/url-to-png/
MIT License
156 stars 28 forks source link

Browsers not being returned to pool on error? #19

Closed saschwarz closed 2 years ago

saschwarz commented 2 years ago

I'm wondering if the browser needs to be returned to the pool if there is an exception? Should this line be in the finally?

https://github.com/jasonraimondi/url-to-png/blob/221817c9bd15ad411e2de5e09731b6f005219522/src/services/image-render.service.ts#L75

jasonraimondi commented 2 years ago

I believe you are correct, good find! If you want to submit a PR and become a contributor to the project I'd happily merge your contribution, otherwise it'll be at least till the EOD for me to get this tweaked.

saschwarz commented 2 years ago

I'll cut a PR. I was thinking it might be best to put another try/finally wrapping where the browser is taken from the pool so if any exception is raised it will always be released.

jasonraimondi commented 2 years ago

Thanks for the PR. I've merged and tagged this in v1.3.3