Class: SidekiqUniqueJobs::Lock::UntilExecuted
- 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
Instance Method Summary collapse
-
#execute { ... } ⇒ Object
Executes in the Sidekiq server process.
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
15 16 17 18 19 20 21 22 |
# File 'lib/sidekiq_unique_jobs/lock/until_executed.rb', line 15 def execute if locked? with_cleanup { yield } else log_warn "the unique_key: #{item[UNIQUE_DIGEST_KEY]} is not locked, allowing job to silently complete" nil end end |