class SidekiqUniqueJobs::Middleware::Client
@author Mikael Henriksson <mikael@zoolutions.se>
The unique sidekiq middleware for the client push
def call(*)
- Yield: - when the lock is successful
Yield: - when uniqueness is disable
Other tags:
- See: https://github.com/mperham/sidekiq/wiki/Middleware -
See: https://github.com/mperham/sidekiq/wiki/Job-Format -
See: SidekiqUniqueJobs::Middleware#call -
def call(*) lock { yield } end
def lock
def lock if (token = lock_instance.lock) yield token else warn_about_duplicate end end
def warn_about_duplicate
def warn_about_duplicate return unless log_duplicate? log_warn "Already locked with another job_id (#{dump_json(item)})" end