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.
Parameters
Section titled “Parameters”any
The error thrown by the http call
attempts
Section titled “attempts”number
The number of attempts made so far, including the one that just failed.
retryConnectionError
Section titled “retryConnectionError”boolean
Whether to retry on ConnectionError (CORS, connection is down, etc.)
Returns
Section titled “Returns”number