Sha256: af2dc2353e054734adc734f2e34c463b17630e6930653ce1c06954ed6b744c44

Contents?: true

Size: 615 Bytes

Versions: 24

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

module SidekiqUniqueJobs
  class Lock
    # Locks jobs until the server is done executing the job
    # - Locks on perform_in or perform_async
    # - Unlocks after yielding to the worker's perform method
    #
    # @author Mikael Henriksson <mikael@zoolutions.se>
    class UntilExecuted < BaseLock
      OK ||= "OK"

      # Executes in the Sidekiq server process
      # @yield to the worker class perform method
      def execute
        lock do
          yield
          unlock_with_callback
          callback_safely
          item[JID]
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-7.0.0.beta25 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta24 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta23 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta22 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta21 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta20 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta19 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta18 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta17 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta16 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta15 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta14 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta13 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta12 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta11 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta10 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta9 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta8 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta7 lib/sidekiq_unique_jobs/lock/until_executed.rb
sidekiq-unique-jobs-7.0.0.beta6 lib/sidekiq_unique_jobs/lock/until_executed.rb