the-markup / blacklight-collector

GNU General Public License v3.0
201 stars 36 forks source link

Close browser in finally block #88

Closed BatMiles closed 5 months ago

BatMiles commented 5 months ago

It appears the puppeteer browser was not always closing when the collector errored out. This adds a call to close the browser in a finally block, ensuring that it gets called and all puppeteer temporary files get cleaned up.

simonft commented 5 months ago

lol: https://github.com/the-markup/blacklight-collector/pull/40/files

If you're going to do this you should probably send the errors to sentry manually.

simonft commented 5 months ago

My thought in #40 was the uncaught error would cause the whole lambda to crash and thus you didn't need to clean up the browser. But if that's incorrect then yeah, something should be handling those.

BatMiles commented 5 months ago

My thought in #40 was the uncaught error would cause the whole lambda to crash and thus you didn't need to clean up the browser. But if that's incorrect then yeah, something should be handling those.

Yeah, the temporary files the browser creates don't get cleaned up unless you close the browser. There isn't a catch here, so errors don't get handled. I think that'll leave them free to get to Sentry.