Set to 0 by default

This commit is contained in:
Yury Semikhatsky 2024-06-19 16:09:31 -07:00
parent a732588a16
commit fdf4861752
5 changed files with 11 additions and 11 deletions

View file

@ -134,7 +134,7 @@ Defaults to `20`. Pass `0` to not follow redirects.
* since: v1.46
- `maxRetries` <[int]>
Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `0` - no retries.
## method: RequestOptions.setMethod
* since: v1.18

View file

@ -462,7 +462,7 @@ Defaults to `20`. Pass `0` to not follow redirects.
* langs: js, python, csharp
- `maxRetries` <[int]>
Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error will be thrown if the limit is exceeded. Defaults to `0` - no retries.
## evaluate-expression
- `expression` <[string]>

View file

@ -248,7 +248,7 @@ export abstract class APIRequestContext extends SdkObject {
}
private async _sendRequestWithRetries(progress: Progress, url: URL, options: SendRequestOptions, postData?: Buffer, maxRetries?: number): Promise<Omit<channels.APIResponse, 'fetchUid'> & { body: Buffer }>{
maxRetries ??= 5;
maxRetries ??= 0;
let backoff = 250;
for (let i = 0; i <= maxRetries; i++) {
try {

View file

@ -15965,7 +15965,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;
@ -16071,7 +16071,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;
@ -16157,7 +16157,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;
@ -16243,7 +16243,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;
@ -16371,7 +16371,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;
@ -16457,7 +16457,7 @@ export interface APIRequestContext {
/**
* Maximum number of times socket errors should be retried. Currently only `ECONNRESET` error is retried. An error
* will be thrown if the limit is exceeded. Defaults to `5`. Pass `0` to disable retries.
* will be thrown if the limit is exceeded. Defaults to `0` - no retries.
*/
maxRetries?: number;

View file

@ -59,7 +59,7 @@ it('should throw on network error', async ({ context, server }) => {
server.setRoute('/test', (req, res) => {
req.socket.destroy();
});
const error = await context.request.get(server.PREFIX + '/test', { maxRetries: 0 }).catch(e => e);
const error = await context.request.get(server.PREFIX + '/test').catch(e => e);
expect(error.message).toContain('apiRequestContext.get: socket hang up');
});
@ -68,7 +68,7 @@ it('should throw on network error after redirect', async ({ context, server }) =
server.setRoute('/test', (req, res) => {
req.socket.destroy();
});
const error = await context.request.get(server.PREFIX + '/redirect', { maxRetries: 0 }).catch(e => e);
const error = await context.request.get(server.PREFIX + '/redirect').catch(e => e);
expect(error.message).toContain('apiRequestContext.get: socket hang up');
});