Exception: Wurk::Limiter::OverLimit

Inherits:
StandardError
  • Object
show all
Defined in:
lib/wurk/limiter.rb

Overview

Server middleware catches OverLimit, increments ‘job`, and reschedules onto the same queue with `Time.now + backoff`. The `#limiter` attr lets the middleware reach the per-limiter backoff proc + reschedule cap. `#job` is set by the middleware just before the re-raise so error_handlers can see which job was in flight.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(limiter, job = nil, msg = nil) ⇒ OverLimit

Returns a new instance of OverLimit.



51
52
53
54
55
# File 'lib/wurk/limiter.rb', line 51

def initialize(limiter, job = nil, msg = nil)
  @limiter = limiter
  @job = job
  super(msg || "limit '#{limiter.name}' (#{limiter.type}) reached")
end

Instance Attribute Details

#jobObject

Returns the value of attribute job.



49
50
51
# File 'lib/wurk/limiter.rb', line 49

def job
  @job
end

#limiterObject (readonly)

Returns the value of attribute limiter.



48
49
50
# File 'lib/wurk/limiter.rb', line 48

def limiter
  @limiter
end