Skip to content

Commit

Permalink
🤕: fix protocal timeout issue
Browse files Browse the repository at this point in the history
  • Loading branch information
merryman committed Dec 16, 2024
1 parent 63a284d commit 8a1ce8d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lively.headless/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,19 @@ export class HeadlessSession {
async open (url, aliveTestFn) {
this.state = SESSION_STATE.LOADING;
if (this.page) await this.close();

const browser = await this.ensureBrowser();
let attempts = 1;
while (true) {
try {
browser = await this.ensureBrowser();
} catch (err) {
if (attempts < 3) {
attempts++;
continue;
}
else throw err;
}
break;
}
const page = this.page = await browser.newPage();
const { options: { aliveTimeout, aliveRepeatTimeout } } = this;

Expand Down

0 comments on commit 8a1ce8d

Please sign in to comment.