Module: CMDx::Retriers::HalfRandom Private
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.
Half-random jitter. Produces a uniform delay in ‘[delay/2, delay]`. Useful when you want a tighter spread than `:full_random` while still decorrelating retries from synchronized clients.
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.
18 19 20 |
# File 'lib/cmdx/retriers/half_random.rb', line 18 def call(_attempt, delay, _prev_delay = nil) (delay / 2.0) + (rand * delay / 2.0) end |