Class: SidekiqIteration::Throttling::ThrottleCondition

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_iteration/throttling.rb

Instance Method Summary collapse

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

#backoffObject



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

Returns:

  • (Boolean)


12
13
14
# File 'lib/sidekiq_iteration/throttling.rb', line 12

def valid?(job)
  @condition.call(job)
end