class MultiBackgroundJob::Middleware::UniqueJob::Sidekiq::Worker
Worker
middleware runs around the execution of a job
Public Instance Methods
call(_worker, job, _queue) { || ... }
click to toggle source
@param worker [Object] the worker instance @param job [Hash] the full job payload
* @see https://github.com/mperham/sidekiq/wiki/Job-Format
@param queue [String] 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/multi_background_job/middleware/unique_job/sidekiq.rb, line 29 def call(_worker, job, _queue) if job.is_a?(Hash) && (unique_lock = unique_job_lock(job)) unique_lock.unlock end yield end
Protected Instance Methods
unique_job_lock(job)
click to toggle source
# File lib/multi_background_job/middleware/unique_job/sidekiq.rb, line 38 def unique_job_lock(job) return unless job['uniq'].is_a?(Hash) unique_job = ::MultiBackgroundJob::UniqueJob.coerce(job['uniq']) unique_job&.lock end