Module: SidekiqUniqueJobs::Unlockable
- Included in:
- Lock::UntilExecuted
- Defined in:
- lib/sidekiq_unique_jobs/unlockable.rb
Class Method Summary collapse
- .after_unlock(jid) ⇒ Object
- .ensure_job_id_removed(jid) ⇒ Object
- .logger ⇒ Object
- .unlock(item) ⇒ Object
- .unlock_by_key(unique_key, jid, redis_pool = nil) ⇒ Object
Class Method Details
.after_unlock(jid) ⇒ Object
14 15 16 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 14 def after_unlock(jid) ensure_job_id_removed(jid) end |
.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 { |redis| redis.hdel(SidekiqUniqueJobs::HASH_KEY, jid) } end |
.logger ⇒ Object
22 23 24 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 22 def logger SidekiqUniqueJobs.logger end |
.unlock(item) ⇒ Object
5 6 7 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 5 def unlock(item) unlock_by_key(item[UNIQUE_DIGEST_KEY], item[JID_KEY]) end |
.unlock_by_key(unique_key, jid, redis_pool = nil) ⇒ Object
9 10 11 12 |
# File 'lib/sidekiq_unique_jobs/unlockable.rb', line 9 def unlock_by_key(unique_key, jid, redis_pool = nil) return false unless Scripts::ReleaseLock.execute(redis_pool, unique_key, jid) after_unlock(jid) end |