Class: SidekiqIteration::Throttling::ThrottleCondition
- Inherits:
-
Object
- Object
- SidekiqIteration::Throttling::ThrottleCondition
- Defined in:
- lib/sidekiq_iteration/throttling.rb
Instance Method Summary collapse
- #backoff ⇒ Object
-
#initialize(condition, backoff) ⇒ ThrottleCondition
constructor
A new instance of ThrottleCondition.
- #valid?(job) ⇒ Boolean
Constructor Details
#initialize(condition, backoff) ⇒ ThrottleCondition
Returns a new instance of ThrottleCondition.
7 8 9 10 |
# File 'lib/sidekiq_iteration/throttling.rb', line 7 def initialize(condition, backoff) @condition = condition @backoff = backoff end |
Instance Method Details
#backoff ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/sidekiq_iteration/throttling.rb', line 16 def backoff if @backoff.is_a?(Proc) @backoff.call else @backoff end end |
#valid?(job) ⇒ Boolean
12 13 14 |
# File 'lib/sidekiq_iteration/throttling.rb', line 12 def valid?(job) @condition.call(job) end |