Module: Sidekiq::Worker::ClassMethods
- Defined in:
- lib/sidekiq_unique_jobs/testing.rb
Overview
Adds class methods to Sidekiq::Worker
Instance Method Summary collapse
-
#clear ⇒ Object
Clears the jobs for this worker and removes all locks.
-
#use_options(tmp_config = {}) ⇒ Object
Temporarily turn a workers sidekiq_options into something different.
Instance Method Details
#clear ⇒ Object
Clears the jobs for this worker and removes all locks
64 65 66 67 68 69 70 71 |
# File 'lib/sidekiq_unique_jobs/testing.rb', line 64 def clear jobs.each do |job| SidekiqUniqueJobs::Unlockable.unlock(job) end Sidekiq::Queues[queue].clear jobs.clear end |
#use_options(tmp_config = {}) ⇒ Object
Note:
this method will restore the original configuration after yielding
Temporarily turn a workers sidekiq_options into something different
51 52 53 54 55 56 57 58 59 |
# File 'lib/sidekiq_unique_jobs/testing.rb', line 51 def (tmp_config = {}) = .dup (.merge(tmp_config)) yield ensure self. = Sidekiq::DEFAULT_WORKER_OPTIONS () end |