Sha256: 7c003994983c3da0a016ba326530ada278a80871cdc5531f02d4c1b4d65310d7
Contents?: true
Size: 740 Bytes
Versions: 17
Compression:
Stored size: 740 Bytes
Contents
module CanvasSync::JobUniqueness module Strategy # Implements two locks - one while enqueued and one while performing class UntilAndWhileExecuting < Base locks_on :enqueue, :perform def on_enqueue # Obtain lock lock!(:enqueue) # Proceed with enqueuing the job, wrapping it in a batch runtime_lock.on_enqueue do yield end end def on_perform # Obtain Runtime lock runtime_lock.on_perform do # Release Queue lock unlock() # Run the job yield end end private def runtime_lock @runtime_lock ||= Strategy::WhileExecuting.new(lock_context) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems