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.



65
66
67
68
69
# File 'lib/wurk/limiter.rb', line 65

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.



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

def job
  @job
end

#limiterObject (readonly)

Returns the value of attribute limiter.



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

def limiter
  @limiter
end