failsafe-lib / failsafe

Fault tolerance and resilience patterns for the JVM
https://failsafe.dev
Apache License 2.0
4.2k stars 297 forks source link

Retry with backoff Added extra 2 seconds. #256

Closed AmarBogari closed 3 years ago

AmarBogari commented 4 years ago

Imagine we have following retry policy

RetryPolicy retryPolicy = new RetryPolicy() .withBackoff(5, 30, ChronoUnit.SECONDS, 2 ) .withMaxRetries(4);

The following time intervals for retry policy work: 1st attempts on 0 seconds 2nd attempts on 7 seconds (5x1+2) 3rd attempts on 12 seconds (5x2+2) 4th attempts on 17 seconds (5x3+2)

So, My question every retry 2 seconds added why? Is this intentionally or an issue?

jhalterman commented 3 years ago

@AmarBogari Perhaps there was a bug in the version you're using, or something that was fixed since? At present, this policy you described results in the following:

RetryPolicy scheduled with delay: 5000 ms
RetryPolicy scheduled with delay: 10000 ms
RetryPolicy scheduled with delay: 20000 ms
RetryPolicy scheduled with delay: 30000 ms
jhalterman commented 3 years ago

Closing for now. Please reopen if needed for further discussion.