Skip to content

calculateRetryBackoff

calculateRetryBackoff(err, attempts, retryConnectionError): number

Defined in: src/http-api/utils.ts:186

Calculate the backoff time for a request retry attempt. This produces wait times of 2, 4, 8, and 16 seconds (30s total) after which we give up. If the failure was due to a rate limited request, the time specified in the error is returned.

Returns -1 if the error is not retryable, or if we reach the maximum number of attempts.

any

The error thrown by the http call

number

The number of attempts made so far, including the one that just failed.

boolean

Whether to retry on ConnectionError (CORS, connection is down, etc.)

number