Interface HttpRetryConfig

A configuration object which configures a request for the HttpRetry function.

interface HttpRetryConfig {
    maxRetries?: number;
    maxWaitTimeSeconds?: number;
    retrieveRetryTime?: ((response) => undefined | number);
    retryKey?: string;
}

Properties

maxRetries?: number

The maximum number of times to retry a request before giving up.

If not provided, the default is 5.

maxWaitTimeSeconds?: number

The maximum amount of time to wait in seconds before aborting the retry process.

If not provided, the default is 20 seconds.

retrieveRetryTime?: ((response) => undefined | number)

Modifies the default behavior of retrieving the retry time from the response.

The default implementation will look for the Retry-After header in the response.

Type declaration

    • (response): undefined | number
    • Parameters

      • response: HttpResponse

        The http response which is being processed due to a 429 response code.

      Returns undefined | number

Returns

A number representing the number of seconds to wait before retrying the request. If undefined is returned, the promise returned by HttpRetry will be resolved with the response.

retryKey?: string

A key used to identify a request. When a key is rate limited all other requests with the same key will assume the rate limit has been reached for them as well.

Not providing this key will disable any proactive rate limiting.