newExponentialBackoff function

BackoffFactory newExponentialBackoff(
  1. Duration min,
  2. Duration max,
  3. Jitter jitter,
  4. Duration timeUnits,
  5. double base,
  6. Duration offset,
  7. Random rng,
)

Creates a BackoffFactory with backoff of the form base^x + offset where x is the attempt number jitter is the function for adding randomness around the backoff timeUnits are the units of time the base^x is evaluated in

Implementation

BackoffFactory newExponentialBackoff(
    Duration min,
    Duration max,
    Jitter jitter,
    Duration timeUnits,
    double base,
    Duration offset,
    Random rng) {
  return () => ExponentialBackoff(
    AttemptBackoff(min, max, jitter, rng),
    timeUnits,
    base,
    offset,
  );
}