Sha256: 83795cdeca920138d95fde681b870a176b461a997758cbb3d880a5380efc0603

Contents?: true

Size: 831 Bytes

Versions: 15

Compression:

Stored size: 831 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

15 entries across 15 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-6.0.25 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.24 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.23 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.22 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.21 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.20 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.16 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.19 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.13 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.12 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.11 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.10 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.9 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.8 lib/sidekiq_unique_jobs/lock/until_expired.rb
sidekiq-unique-jobs-6.0.7 lib/sidekiq_unique_jobs/lock/until_expired.rb