module Sidekiq::Worker::ClassMethods

def use_options(tmp_config = {})

Parameters:
  • tmp_config (Hash) -- the temporary config to use

Other tags:
    Note: - this method will restore the original configuration after yielding
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