module Sidekiq::Worker::ClassMethods
Adds class methods to Sidekiq::Worker
Public Instance Methods
clear()
click to toggle source
Clears the jobs for this worker and removes all locks
# 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 = {}) { || ... }
click to toggle source
Temporarily turn a workers sidekiq_options into something different
@note this method will restore the original configuration after yielding
@param [Hash<Symbol, Object>] tmp_config the temporary config to use
# File lib/sidekiq_unique_jobs/testing.rb, line 51 def use_options(tmp_config = {}) old_options = sidekiq_options_hash.dup sidekiq_options(old_options.merge(tmp_config)) yield ensure self.sidekiq_options_hash = Sidekiq::DEFAULT_WORKER_OPTIONS sidekiq_options(old_options) end