Closed Stevemoretz closed 12 months ago
Just by skimming your code, it's probably 100ms?
According to README, the default retryDelay
time is 0.
So I think we need to implement the function as follows.
axiosRetry(axios, { retryDelay: () => return 1500 });
Just by skimming your code, it's probably 100ms?
Since it is an Exponential Backoff
, I believe the Delay time is not constant but increases exponentially.
https://cloud.google.com/iot/docs/how-tos/exponential-backoff
According to README, the default
retryDelay
time is 0.So I think we need to implement the function as follows.
axiosRetry(axios, { retryDelay: () => return 1500 });
Just by skimming your code, it's probably 100ms?
Since it is an
Exponential Backoff
, I believe the Delay time is not constant but increases exponentially. https://cloud.google.com/iot/docs/how-tos/exponential-backoff
Thanks so much for the detailed explanation, and sorry I forgot to mention I was using the exponential, and using that the delay changes as you mentioned but what I was after was the initial delay for instance :
If the initial delay is 1s. The delays will be : 1s,2s,4s,... If the initial delay is 2s. The delays will be : 2s,4s,8s,...
So essentially the initial delay is responsible for how slow or fast the retries happen.
If the initial delay is 1s. The delays will be : 1s,2s,4s,... If the initial delay is 2s. The delays will be :2s,4s,8s,...
So essentially the initial delay is responsible for how slow or fast the retries happen.
If such behavior is desired, one answer seems to be to implement the following.
const initialDelay = 2;
axiosRetry(axios, { retryDelay: (retryNumber) => return Math.pow(initialDelay, retryNumber) });
Thanks! Makes sense, closing :)
Using Apollo's retry for instance you can define an initial retry time.
While this library, doesn't have that option at least it would be nice to mention what the initial time is by default adding an option to change it however would be awesome.