Module: ActiveJob::Uniqueness::Strategies::Base::LockingOnEnqueue
- Defined in:
- lib/active_job/uniqueness/strategies/base.rb
Instance Method Summary collapse
Instance Method Details
#around_enqueue(block) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/active_job/uniqueness/strategies/base.rb', line 65 def around_enqueue(block) return if @job_aborted # ActiveJob 4.2 workaround enqueued = false block.call enqueued = true ensure unlock(resource: lock_key) unless @job_aborted || enqueued end |
#before_enqueue ⇒ Object
58 59 60 61 62 63 |
# File 'lib/active_job/uniqueness/strategies/base.rb', line 58 def before_enqueue return if lock(resource: lock_key, ttl: lock_ttl) handle_conflict(resource: lock_key, on_conflict: on_conflict) abort_job end |