Sha256: 39b4edcd8df74692e40d432a4625bb915fc0af414805cda449925a75d1ddacac

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 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@mhenrixon.com>
    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

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq-unique-jobs-7.0.13 lib/sidekiq_unique_jobs/lock/until_executed.rb