class Cloudtasker::UniqueJob::Lock::UntilExecuting

Conflict if any other job with the same args is scheduled while the first job is pending.

Public Instance Methods

execute() { || ... } click to toggle source

Release the lock and perform the job.

# File lib/cloudtasker/unique_job/lock/until_executing.rb, line 23
def execute
  job.unlock!
  yield
end
schedule() { || ... } click to toggle source

Acquire a lock for the job and trigger a conflict if the lock could not be acquired.

# File lib/cloudtasker/unique_job/lock/until_executing.rb, line 13
def schedule
  job.lock!
  yield
rescue LockError
  conflict_instance.on_schedule { yield }
end