Sha256: 3008dad88cfa4032fe35bbc107ab9a510d33f4317a9ae90371ae698a3627f67d

Contents?: true

Size: 830 Bytes

Versions: 9

Compression:

Stored size: 830 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  class Lock
    # Locks jobs until the lock has expired
    # - Locks on perform_in or perform_async
    # - Unlocks when the expiration is hit
    #
    # See {#lock} for more information about the client.
    # See {#execute} for more information about the server
    #
    # @author Mikael Henriksson <mikael@zoolutions.se>
    class UntilExpired < BaseLock
      # Prevents these locks from being unlocked
      # @return [true] always returns true
      def unlock
        true
      end

      # Executes in the Sidekiq server process
      # @yield to the worker class perform method
      def execute
        return unless locked?
        yield
        # this lock does not handle after_unlock since we don't know when that would happen
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.6 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.5 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.4 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.3 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.2 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.1 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.0 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.0.rc8 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.0.rc7 lib/sidekiq_unique_jobs/lock/until_expired.rb