Sha256: e21a82946ff736cd843e6cbb18828c7413f864e6c7cbbc8d04ab3525973f43c3
Contents?: true
Size: 632 Bytes
Versions: 49
Compression:
Stored size: 632 Bytes
Contents
# frozen_string_literal: true module Cloudtasker module UniqueJob module Lock # Conflict if any other job with the same args is moved to execution # while the first job is executing. class WhileExecuting < BaseLock # # Acquire a lock for the job and trigger a conflict # if the lock could not be acquired. # 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 end end end end
Version data entries
49 entries across 49 versions & 1 rubygems