-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix exponential Backoff overflow/npe issues by using ms for cap (#282)
This commit changes the exponential backoff default maxBackoff to be Long.MAX_VALUE _milliseconds_ instead of _seconds_. The limit still represents over 292 million years, plenty enough for a backoff :) This prevents overflow and arithmetic exceptions, notably when computing a jitter on top. This upper limit is also enforced in the constructor when explicitly passing in a `maxBackoff`. This commit also fixes 2 additional issues: - the computed BackoffDelay could have a `delay` component greater than the `max`, which would result in a negative jitter higher bound when computing the jitter bounds (now prevented in Backoff.exponential) - the "depends on previous value" variant would not use the default maxBackoffInterval if provided maxBackoff parameter was null, leading to a NullPointerException. Supersedes and closes #269.
- Loading branch information
1 parent
cceaba5
commit fc0caa2
Showing
2 changed files
with
58 additions
and
7 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