mirror of
https://github.com/webrecorder/browsertrix-crawler.git
synced 2025-10-19 06:23:16 +00:00
further fix to stuck on getting new window: (#779)
- set retries back to 3, was set high by mistake - if will restart, throw exception to restart crawler - otherwise, attempt to kill browser process that is stalled (appears to work in testing) - follow-up to #766
This commit is contained in:
parent
e402ddc202
commit
24ca818356
2 changed files with 18 additions and 2 deletions
|
@ -396,6 +396,18 @@ export class Browser {
|
|||
}
|
||||
}
|
||||
|
||||
killBrowser() {
|
||||
// used when main browser process appears to be stalled
|
||||
// puppeteer should still be able to continue, from initial testing
|
||||
// and avoids interrupting crawler when not auto-restarting
|
||||
if (this.browser) {
|
||||
const proc = this.browser.process();
|
||||
if (proc) {
|
||||
proc.kill();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async addInitScript(page: Page, script: string) {
|
||||
await page.evaluateOnNewDocument(script);
|
||||
}
|
||||
|
|
|
@ -231,9 +231,13 @@ export class PageWorker {
|
|||
break;
|
||||
}
|
||||
|
||||
if (retry >= 1000000000) {
|
||||
if (retry >= 2) {
|
||||
this.crawler.markBrowserCrashed();
|
||||
throw new Error("Unable to load new page, browser needs restart");
|
||||
if (this.crawler.params.restartsOnError) {
|
||||
throw new Error("Unable to load new page, browser needs restart");
|
||||
} else {
|
||||
this.crawler.browser.killBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
await sleep(0.5);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue