Class: SidekiqUniqueJobs::Lock::UntilAndWhileExecuting

Inherits:
UntilExecuting show all
Defined in:
lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb

Instance Method Summary collapse

Methods inherited from UntilExecuted

#after_yield_yield, #initialize, #lock, #max_lock_time, #unique_key, #unlock

Methods included from Unlockable

after_unlock, ensure_job_id_removed, logger, unlock, unlock_by_key

Constructor Details

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

Instance Method Details

#execute(callback) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/sidekiq_unique_jobs/lock/until_and_while_executing.rb', line 6

def execute(callback)
  lock = WhileExecuting.new(item, redis_pool)
  lock.synchronize do
    callback.call if unlock(:server)
    yield
  end
end