Sha256: 2a5716c4a497d27a95c9f4fb1ccb44de4032b4be6ef35d2bdd8a7273522459ae

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 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
        return unless locked?

        with_cleanup { yield }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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