Skip to content

Commit

Permalink
fix: increase the default protocol timeout
Browse files Browse the repository at this point in the history
This PR increases the protocol timeout to be less likely triggered
by normal operations but still indicate errors in case of backend
issues instead of waiting forever. Unfortunately, the current
script evaluation API does not allow configuring the timeouts per
operations and it's not possible to change this due to variadic arguments
accepted in evaluate and evaluateHandle. We could consider exposing
new methods which also accept a timeout but for now let's see if increasing
the connection timeout is good enough.

Issue #9927
  • Loading branch information
OrKoN committed Mar 28, 2023
1 parent 3866e46 commit 84c5d7a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/api/puppeteer.browserconnectoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. | |
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ interface BrowserConnectOptions {

#### Default value:

30000
180000
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/BrowserConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface BrowserConnectOptions {
/**
* Timeout setting for individual protocol (CDP) calls.
*
* @defaultValue 30000
* @defaultValue 180000
*/
protocolTimeout?: number;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,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);
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/bidi/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 84c5d7a

Please sign in to comment.