Rexsilient.Retry.Strategy.Exponential (Rexsilient v1.0.0)

Copy Markdown View Source

Doubles the wait after every attempt, up to a maximum.

The wait after attempt n is base_delay * 2 ** (n - 1), capped at max_delay: with a base_delay of 100, it waits 100, 200, 400, ...

Options

  • :base_delay - the wait, in milliseconds, after the first attempt. Required.

  • :max_delay - the longest wait, in milliseconds. Required.

  • :jitter - how the wait is randomized, so that callers failing at the same time do not retry at the same time. :none (the default) uses the exact wait, :full a random one from 0 to it (see Rexsilient.Jitter.full/3), and :equal a random one from half of it to it (see Rexsilient.Jitter.equal/3).

Examples

strategy Rexsilient.Retry.Strategy.Exponential,
  base_delay: 100,
  max_delay: 5_000,
  jitter: :full