Class: CanvasSync::JobUniqueness::Strategy::UntilAndWhileExecuting
- Defined in:
- lib/canvas_sync/job_uniqueness/strategy/until_and_while_executing.rb
Overview
Implements two locks - one while enqueued and one while performing
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#batch_callback, #initialize, locks_on
Constructor Details
This class inherits a constructor from CanvasSync::JobUniqueness::Strategy::Base
Instance Method Details
#on_enqueue ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/canvas_sync/job_uniqueness/strategy/until_and_while_executing.rb', line 7 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 |
#on_perform ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/canvas_sync/job_uniqueness/strategy/until_and_while_executing.rb', line 17 def on_perform # Obtain Runtime lock runtime_lock.on_perform do # Release Queue lock unlock() # Run the job yield end end |