ExponentialBackoff is a backoff implementation that increases the backoff
period for each retry attempt using a randomization function that grows exponentially.
next_backoff is calculated using the following formula:
randomized interval = retry_interval * (random value in range [1 - randomization_factor, 1 + randomization_factor])
In other words
next_backoff will range between the randomization factor
percentage below and above the retry interval.
For example, given the following parameters:
retry_interval = 2 randomization_factor = 0.5 multiplier = 2
the actual backoff period used in the next retry attempt will range between 1 and 3 seconds, multiplied by the exponential, that is, between 2 and 6 seconds.
max_interval caps the
retry_interval and not the randomized interval.
The elapsed time can be reset by calling
Example: Given the following default arguments, for 10 tries the sequence will be,
and assuming we go over the
max_elapsed_time on the 10th try:
||Randomized Interval (seconds)|
Constants for the exponential backoff policy.
Error is the error value in an operation's result.
Clock returns the current time.
Notify is called in
Operation is an operation that can be retried if it fails.
Exponential backoff policy with system's clock.