Documentation
    Preparing search index...

    Interface RetryOptions

    interface RetryOptions {
        afterStatusCodes?: number[];
        factor?: number;
        maxRetryTime?: number;
        maxTimeout?: number;
        methods?: string[];
        minTimeout?: number;
        randomize?: boolean;
        retries?: number;
        shouldRetry?: (context: RetryContext) => boolean | Promise<boolean>;
        unref?: boolean;
    }
    Index

    Properties

    afterStatusCodes?: number[]

    The status codes to retry after

    Request will wait until the date, timeout, or timestamp given in the Retry-After header has passed to retry the request. If Retry-After is missing, the non-standard RateLimit-Reset header is used in its place as a fallback. If the provided status code is not in the list, the Retry-After header will be ignored.

    [413, 429, 503]
    
    factor?: number

    The exponential factor to use.

    2
    
    maxRetryTime?: number

    The maximum time (in milliseconds) that the retried operation is allowed to run.

    Infinity
    
    maxTimeout?: number

    The maximum number of milliseconds between two retries.

    Infinity
    
    methods?: string[]

    The methods to retry

    ['get', 'put', 'head', 'delete', 'options', 'trace']
    
    minTimeout?: number

    The number of milliseconds before starting the first retry.

    1000
    
    randomize?: boolean

    Randomizes the timeouts by multiplying a factor between 1-2.

    false
    
    retries?: number

    The maximum amount of times to retry the operation.

    10
    
    shouldRetry?: (context: RetryContext) => boolean | Promise<boolean>

    Decide if a retry should occur based on the context. Returning true triggers a retry, false aborts with the error.

    It is only called if retries and maxRetryTime have not been exhausted.

    It is not called for TypeError (except network errors) and AbortError.

    Type Declaration

      • (context: RetryContext): boolean | Promise<boolean>
      • Parameters

        • context: RetryContext

          The context of the retry

        Returns boolean | Promise<boolean>

        • Whether to retry the request
    unref?: boolean

    Whether to unref the setTimeout's.

    false