Sha256: 936dfee9cab5ac38f7692e8f3362ab7cd1180947d91f396f3a536d9bbd4947eb
Contents?: true
Size: 1003 Bytes
Versions: 22
Compression:
Stored size: 1003 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(*) lock { yield } end private def lock if (token = lock_instance.lock) yield token 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
22 entries across 22 versions & 1 rubygems