lib/cloudtasker/unique_job/lock/until_executed.rb in cloudtasker-0.13.2 vs lib/cloudtasker/unique_job/lock/until_executed.rb in cloudtasker-0.14.rc1
- old
+ new
@@ -8,25 +8,25 @@
class UntilExecuted < BaseLock
#
# Acquire a lock for the job and trigger a conflict
# if the lock could not be acquired.
#
- def schedule
+ def schedule(&block)
job.lock!
yield
rescue LockError
- conflict_instance.on_schedule { yield }
+ conflict_instance.on_schedule(&block)
end
#
# Acquire a lock for the job and trigger a conflict
# if the lock could not be acquired.
#
- def execute
+ def execute(&block)
job.lock!
yield
rescue LockError
- conflict_instance.on_execute { yield }
+ conflict_instance.on_execute(&block)
ensure
# Unlock the job on any error to avoid deadlocks.
job.unlock!
end
end