Sha256: 734ffbef40b9f96a05a0ede1cba1816fef91cd1389c1d73495e9acaef836846c
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 Bytes
Contents
# frozen_string_literal: true module SidekiqUniqueJobs module Middleware # The unique sidekiq middleware for the client push # # @author Mikael Henriksson <mikael@zoolutions.se> class Client prepend SidekiqUniqueJobs::Middleware # Calls this client middleware # Used from Sidekiq.process_single # # @see SidekiqUniqueJobs::Middleware#call # # @see https://github.com/mperham/sidekiq/wiki/Job-Format # @see https://github.com/mperham/sidekiq/wiki/Middleware # # @yield when uniqueness is disable # @yield when the lock is successful def call(*, &block) lock(&block) end private def lock if (_token = lock_instance.lock) yield else warn_about_duplicate end end def warn_about_duplicate return unless log_duplicate? log_warn "Already locked with another job_id (#{dump_json(item)})" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sidekiq-unique-jobs-7.0.0.beta25 | lib/sidekiq_unique_jobs/middleware/client.rb |
sidekiq-unique-jobs-7.0.0.beta24 | lib/sidekiq_unique_jobs/middleware/client.rb |