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
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/active_job/uniqueness/strategies/base.rb', line 72 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
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/active_job/uniqueness/strategies/base.rb', line 59 def before_enqueue return if lock(resource: lock_key, ttl: lock_ttl) handle_conflict(resource: lock_key, on_conflict: on_conflict) abort_job rescue RedisClient::ConnectionError => e handle_redis_connection_error( resource: lock_key, on_redis_connection_error: on_redis_connection_error, error: e ) abort_job end |