Skip to content

Commit 7a9d498

Browse files
committed
improve reusing of puppeteer by adding a safeguard for broken chrome
1 parent 9a87c58 commit 7a9d498

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/services/jobs/jobExecutionService.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ export function initJobExecutionService({ providers, settings, intervalMs }) {
168168
const matchedProvider = providers.find((loaded) => loaded.metaInformation.id === prov.id);
169169
matchedProvider.init(prov, job.blacklist);
170170

171+
if (browser && !browser.isConnected()) {
172+
logger.debug('Browser is disconnected, nullifying to launch a new one.');
173+
await puppeteerExtractor.closeBrowser(browser);
174+
browser = null;
175+
}
176+
171177
if (!browser && matchedProvider.config.getListings == null) {
172178
browser = await puppeteerExtractor.launchBrowser(matchedProvider.config.url, {});
173179
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fredy",
3-
"version": "19.5.0",
3+
"version": "19.5.1",
44
"description": "[F]ind [R]eal [E]states [d]amn eas[y].",
55
"scripts": {
66
"prepare": "husky",

0 commit comments

Comments
 (0)