Module: SidekiqUniqueJobs::Unlockable
- Included in:
- Sidekiq::Worker::ClassMethods
- Defined in:
- lib/sidekiq_unique_jobs/unlockable.rb
Class Method Summary collapse
-
.unlock(unique_key, jid, redis_pool = nil) ⇒ Object
rubocop:disable MethodLength.
Class Method Details
.unlock(unique_key, jid, redis_pool = nil) ⇒ Object
rubocop:disable MethodLength
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 6 def unlock(unique_key, jid, redis_pool = nil) result = Scripts.call(:release_lock, redis_pool, keys: [unique_key], argv: [jid]) case result when 1 Sidekiq.logger.debug { "successfully unlocked #{unique_key}" } true when 0 Sidekiq.logger.debug { "expiring lock #{unique_key} is not owned by #{jid}" } false when -1 Sidekiq.logger.debug { "#{unique_key} is not a known key" } false else fail "#{__method__} returned an unexpected value (#{result})" end end |