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