Type alias RetryOptions

RetryOptions: {
    afterStatusCodes?: number[];
    backoffLimit?: number;
    delay?: ((attemptCount) => number);
    limit?: number;
    maxRetryAfter?: number;
    methods?: string[];
    statusCodes?: number[];
}

Type declaration

  • Optional afterStatusCodes?: number[]

    The HTTP status codes allowed to retry with a Retry-After header.

    Default

    [413, 429, 503]
    
  • Optional backoffLimit?: number

    The upper limit of the delay per retry in milliseconds. To clamp the delay, set backoffLimit to 1000, for example.

    By default, the delay is calculated in the following way:

    0.3 * (2 ** (attemptCount - 1)) * 1000
    

    The delay increases exponentially.

    Default

    Infinity
    
  • Optional delay?: ((attemptCount) => number)

    A function to calculate the delay between retries given attemptCount (starts from 1).

    Default

    attemptCount => 0.3 * (2 ** (attemptCount - 1)) * 1000
    
      • (attemptCount): number
      • Parameters

        • attemptCount: number

        Returns number

  • Optional limit?: number

    The number of times to retry failed requests.

    Default

    2
    
  • Optional maxRetryAfter?: number

    If the Retry-After header is greater than maxRetryAfter, the request will be canceled.

    Default

    Infinity
    
  • Optional methods?: string[]

    The HTTP methods allowed to retry.

    Default

    ['get', 'put', 'head', 'delete', 'options', 'trace']
    
  • Optional statusCodes?: number[]

    The HTTP status codes allowed to retry.

    Default

    [408, 413, 429, 500, 502, 503, 504]
    

Generated using TypeDoc