You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// use a ConstantBackoff
const constDelayRetry = Policy.handleAll()
.retry()
.attempts(3)
.backoff(new ConstantBackoff(10, 3));
constDelayRetry.onRetry(({ delay }) => console.log('delay for next call: ', delay));
await constDelayRetry.execute(() => {
throw new Error('exception');
});
// use a DelegateBackoff
const delegatedDelayPolicy = Policy.handleAll()
.retry()
.attempts(3)
.backoff(new DelegateBackoff(() => 10));
delegatedDelayPolicy.onRetry(({ delay }) => console.log('delay for next call: ', delay));
await delegatedDelayPolicy.execute(() => {
throw new Error('exception');
});
The output looks like
delay for next call: 10
delay for next call: 10
delay for next call: 10
delay for next call: 0
delay for next call: 10
delay for next call: 10
Conceptually, I would expect all delays are 10, but unfortunately, the first delay of DelegateBackoff is always 0.
Looks like the ExponentialBackoff has the same problem.
But Polly doesn't has such problem.
It looks like RetryPolicy.execute should adjust the logic to backoff.next() first then do the delay.
The text was updated successfully, but these errors were encountered:
Let's take look at an example
The output looks like
Conceptually, I would expect all delays are 10, but unfortunately, the first delay of
DelegateBackoff
is always 0.Looks like the
ExponentialBackoff
has the same problem.But Polly doesn't has such problem.
It looks like
RetryPolicy.execute
should adjust the logic tobackoff.next()
first then do the delay.The text was updated successfully, but these errors were encountered: