Sha256: 1665ca70463aa960e43750022a8643d2edb448ccf2de07e23d7a02f37a1bdb48
Contents?: true
Size: 850 Bytes
Versions: 2
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true module Cloudtasker module UniqueJob module Lock # Conflict if any other job with the same args is scheduled or moved to execution # while the first job is pending or executing. class UntilExecuted < BaseLock # # Acquire a lock for the job and trigger a conflict # if the lock could not be acquired. # def schedule job.lock! yield rescue LockError conflict_instance.on_schedule { yield } end # # Acquire a lock for the job and trigger a conflict # if the lock could not be acquired. # def execute job.lock! yield job.unlock! rescue LockError conflict_instance.on_execute { yield } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloudtasker-0.2.0 | lib/cloudtasker/unique_job/lock/until_executed.rb |
cloudtasker-0.1.0 | lib/cloudtasker/unique_job/lock/until_executed.rb |