Module: SidekiqUniqueJobs::Unlockable

Included in:
Lock::UntilExecuted
Defined in:
lib/sidekiq_unique_jobs/unlockable.rb

Class Method Summary collapse

Class Method Details

.ensure_job_id_removed(jid) ⇒ Object


18
19
20
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 18

def ensure_job_id_removed(jid)
  Sidekiq.redis { |conn| conn.hdel(SidekiqUniqueJobs::HASH_KEY, jid) }
end

.loggerObject


22
23
24
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 22

def logger
  SidekiqUniqueJobs.logger
end

.unlock(item) ⇒ Object


7
8
9
10
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 7

def unlock(item)
  return unless item[UNIQUE_DIGEST_KEY]
  unlock_by_key(item[UNIQUE_DIGEST_KEY], item[JID_KEY])
end

.unlock_by_key(unique_key, jid, redis_pool = nil) ⇒ Object


12
13
14
15
16
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 12

def unlock_by_key(unique_key, jid, redis_pool = nil)
  lock_released = Scripts::ReleaseLock.execute(redis_pool, unique_key, jid)
  ensure_job_id_removed(jid)
  lock_released
end