fix: increase the default protocol timeout (#9928)

This commit is contained in:
Alex Rudenko 2023-03-28 14:35:13 +02:00 committed by GitHub
parent c4e1675589
commit 4465f4bd19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 6 deletions

View File

@ -18,6 +18,6 @@ export interface BrowserConnectOptions
| ---------------------------------------------------------------------------- | --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
| [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | | [Viewport](./puppeteer.viewport.md) \| null | _(Optional)_ Sets the viewport for each page. | |
| [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | | boolean | _(Optional)_ Whether to ignore HTTPS errors during navigation. | false |
| [protocolTimeout?](./puppeteer.browserconnectoptions.protocoltimeout.md) | | number | _(Optional)_ Timeout setting for individual protocol (CDP) calls. | 30000 |
| [protocolTimeout?](./puppeteer.browserconnectoptions.protocoltimeout.md) | | number | _(Optional)_ Timeout setting for individual protocol (CDP) calls. | 180000 |
| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | | number | _(Optional)_ Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | |
| [targetFilter?](./puppeteer.browserconnectoptions.targetfilter.md) | | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | _(Optional)_ Callback to decide if Puppeteer should connect to a given target or not. | |

View File

@ -16,4 +16,4 @@ interface BrowserConnectOptions {
#### Default value:
30000
180000

View File

@ -62,7 +62,7 @@ export interface BrowserConnectOptions {
/**
* Timeout setting for individual protocol (CDP) calls.
*
* @defaultValue 30000
* @defaultValue 180000
*/
protocolTimeout?: number;
}

View File

@ -72,7 +72,12 @@ class Callback {
this.#label = label;
if (timeout) {
this.#timer = setTimeout(() => {
this.#promise.reject(rewriteError(this.#error, `${label} timed out.`));
this.#promise.reject(
rewriteError(
this.#error,
`${label} timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`
)
);
}, timeout);
}
}
@ -194,7 +199,7 @@ export class Connection extends EventEmitter {
super();
this.#url = url;
this.#delay = delay;
this.#timeout = timeout ?? 30000;
this.#timeout = timeout ?? 180_000;
this.#transport = transport;
this.#transport.onmessage = this.onMessage.bind(this);

View File

@ -96,7 +96,7 @@ export class Connection extends EventEmitter {
constructor(transport: ConnectionTransport, delay = 0, timeout?: number) {
super();
this.#delay = delay;
this.#timeout = timeout;
this.#timeout = timeout ?? 180_000;
this.#transport = transport;
this.#transport.onmessage = this.onMessage.bind(this);