Class: SidekiqUniqueJobs::Lock::UntilExecuted

Inherits:
BaseLock
  • Object
show all
Defined in:
lib/sidekiq_unique_jobs/lock/until_executed.rb

Overview

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:

Instance Method Summary collapse

Methods inherited from BaseLock

#delete, #delete!, #initialize, #lock, #locked?, #unlock

Methods included from SidekiqUniqueJobs::Logging

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger, #logging_context

Constructor Details

This class inherits a constructor from SidekiqUniqueJobs::Lock::BaseLock

Instance Method Details

#execute { ... } ⇒ Object

Executes in the Sidekiq server process

Yields:

  • to the worker class perform method



15
16
17
18
19
# File 'lib/sidekiq_unique_jobs/lock/until_executed.rb', line 15

def execute
  return unless locked?

  with_cleanup { yield }
end