-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Smaller max delays and retry/repeat strategies with delta jitter (#1447)
__Motivation__ When using `[retry,repeat]WithExponentialBackoffDeltaJitter()` if the `maxDelay` is closer to `initialDelay`, it may so happen that after a few retries the `baseDelayNanos` (delay before jitter) becomes greater than `maxDelayNanos`. While getting the random jitter we make sure to not exceed `maxDelayNanos` for the upper bound but lower bound may exceed `maxDelayNanos` hence making the call to `nextLong()` invalid. __Modification__ Add a cap on `baseDelayNanos` such that it never exceeds `maxDelayNanos` and hence the call to `nextLong` always has the lower bound smaller than the upper bound. __Result__ `[retry,repeat]WithExponentialBackoffDeltaJitter()` can work with smaller `maxDelay` values.
- Loading branch information
Nitesh Kant
authored
Mar 19, 2021
1 parent
57c7e74
commit 35b4293
Showing
4 changed files
with
98 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters