Module: CMDx::Retriers::DecorrelatedJitter Private
- Extended by:
- DecorrelatedJitter
- Included in:
- DecorrelatedJitter
- Defined in:
- lib/cmdx/retriers/decorrelated_jitter.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
AWS-recommended decorrelated jitter. Produces a uniform delay in ‘[delay, prev_delay * 3]`, threading state across attempts via `prev_delay`. When no previous delay exists the upper bound collapses to `3 * delay`, matching the AWS reference implementation.
Instance Method Summary collapse
-
#call(_attempt, delay, prev_delay = nil) ⇒ Float
private
Computed delay.
Instance Method Details
#call(_attempt, delay, prev_delay = nil) ⇒ Float
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns computed delay.
21 22 23 24 |
# File 'lib/cmdx/retriers/decorrelated_jitter.rb', line 21 def call(_attempt, delay, prev_delay = nil) base = prev_delay || delay delay + (rand * ((base * 3) - delay)) end |