Sha256: 804fed29a4ab779c3d5cb35dd9438d6802ed8fe16981c3206629cd4b8c46b8b8

Contents?: true

Size: 1.06 KB

Versions: 16

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  module Middleware
    # The unique sidekiq middleware for the client push
    #
    # @author Mikael Henriksson <mikael@mhenrixon.com>
    class Client
      # prepend "SidekiqUniqueJobs::Middleware"
      # @!parse prepends SidekiqUniqueJobs::Middleware
      prepend SidekiqUniqueJobs::Middleware
      # includes "SidekiqUniqueJobs::Reflectable"
      # @!parse include SidekiqUniqueJobs::Reflectable
      include SidekiqUniqueJobs::Reflectable

      # 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
        lock_instance.lock do
          reflect(:locked, item)
          return yield
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-7.1.23 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.22 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.21 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.20 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.19 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.18 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.17 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.16 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.15 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.14 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.13 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.12 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.11 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.10 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.8 lib/sidekiq_unique_jobs/middleware/client.rb
sidekiq-unique-jobs-7.1.7 lib/sidekiq_unique_jobs/middleware/client.rb