class Cutoff::Sidekiq::ServerMiddleware
Add an option `cutoff` for sidekiq workers
@example
class MyWorker include Sidekiq::Worker sidekiq_options cutoff: 6.0 def perform # ... end end
Public Instance Methods
call(worker, _job, _queue) { || ... }
click to toggle source
@param worker [Object] the worker instance @param _job [Hash] the full job payload @param _queue [String] queue the name of the queue the job was pulled
from
@yield the next middleware in the chain or worker `perform` method @return [void]
# File lib/cutoff/sidekiq.rb, line 26 def call(worker, _job, _queue) allowed_seconds = worker.class.sidekiq_options['cutoff'] return yield if allowed_seconds.nil? Cutoff.wrap(allowed_seconds) { yield } end