Slow down initial retry attempt #333
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Currently gaxios attempts the first retry without delay:
gaxios/src/retry.ts
Line 64 in 5b586d5
As
config.currentRetryAttempt
is0
after the first failure the first delay will be 0ms.If often makes sense to wait a little while before making a retry e.g. if the services responds with 429 or 503. It would be nice if retry.ts was less aggressive by default.
A workaround now is to set retryConfig.currentRetryAttempt to a non-zero value, e.g 1 before making the call to gaxios.request() but this relies on the internal implementation of the backoff logic and you'd also need to adjust retryConfig.retry..
Could the default retry implement instead be adjusted with a minimum delay value or make the backoff calculation configurable with a function that could be overridden in retryConfig e.g. something like:
The text was updated successfully, but these errors were encountered: