Class: Sidekiq::Ultimate::IntervalWithJitter
- Inherits:
-
Object
- Object
- Sidekiq::Ultimate::IntervalWithJitter
- Defined in:
- lib/sidekiq/ultimate/interval_with_jitter.rb
Overview
Util class to add a jitter to the interval
Constant Summary collapse
- RANDOM_OFFSET_RATIO =
0.1
Class Method Summary collapse
-
.call(interval) ⇒ Object
Returns execution interval with jitter.
Class Method Details
.call(interval) ⇒ Object
Returns execution interval with jitter. Jitter is +- RANDOM_OFFSET_RATIO from the original value.
12 13 14 15 |
# File 'lib/sidekiq/ultimate/interval_with_jitter.rb', line 12 def call(interval) jitter_factor = 1 + rand(-RANDOM_OFFSET_RATIO..RANDOM_OFFSET_RATIO) jitter_factor * interval end |