class Cloudtasker::UniqueJob::Lock::UntilExecuted
Conflict if any other job with the same args is scheduled or moved to execution while the first job is pending or executing.
Public Instance Methods
execute() { || ... }
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_executed.rb, line 24 def execute job.lock! yield rescue LockError conflict_instance.on_execute { yield } ensure # Unlock the job on any error to avoid deadlocks. job.unlock! 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_executed.rb, line 13 def schedule job.lock! yield rescue LockError conflict_instance.on_schedule { yield } end