Exception: Wurk::Limiter::OverLimit

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

Overview

Server middleware catches OverLimit, increments job['overrated'], 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.



61
62
63
64
65
# File 'lib/wurk/limiter.rb', line 61

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.



59
60
61
# File 'lib/wurk/limiter.rb', line 59

def job
  @job
end

#limiterObject (readonly)

Returns the value of attribute limiter.



58
59
60
# File 'lib/wurk/limiter.rb', line 58

def limiter
  @limiter
end