timeout
This commit is contained in:
@@ -435,6 +435,10 @@ export class BrowserManager {
|
|||||||
const context = await this.browser.newContext({
|
const context = await this.browser.newContext({
|
||||||
viewport: options.viewport ?? { width: 1280, height: 720 },
|
viewport: options.viewport ?? { width: 1280, height: 720 },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Set default timeout to 10 seconds (Playwright default is 30s)
|
||||||
|
context.setDefaultTimeout(10000);
|
||||||
|
|
||||||
this.contexts.push(context);
|
this.contexts.push(context);
|
||||||
|
|
||||||
// Create initial page
|
// Create initial page
|
||||||
@@ -470,6 +474,7 @@ export class BrowserManager {
|
|||||||
const context = await this.browser.newContext({
|
const context = await this.browser.newContext({
|
||||||
viewport: viewport ?? { width: 1280, height: 720 },
|
viewport: viewport ?? { width: 1280, height: 720 },
|
||||||
});
|
});
|
||||||
|
context.setDefaultTimeout(10000);
|
||||||
this.contexts.push(context);
|
this.contexts.push(context);
|
||||||
|
|
||||||
const page = await context.newPage();
|
const page = await context.newPage();
|
||||||
|
|||||||
+3
-3
@@ -128,14 +128,14 @@ export async function sendCommand(command: Record<string, unknown>): Promise<Res
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Timeout after 60 seconds
|
// Timeout after 15 seconds (allows for 10s Playwright timeout + overhead)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (!resolved) {
|
if (!resolved) {
|
||||||
debug('Command timeout after 60s');
|
debug('Command timeout after 15s');
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
reject(new Error('Command timeout'));
|
reject(new Error('Command timeout'));
|
||||||
}
|
}
|
||||||
}, 60000);
|
}, 15000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user