Module: Sidekiq Private

Defined in:
lib/sidekiq_unique_jobs/testing.rb,
lib/sidekiq_unique_jobs/sidekiq_unique_ext.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Modules: Worker Classes: Job, JobRecord, JobSet, Queue, ScheduledSet, SortedEntry

Class Method Summary collapse

Class Method Details

.use_options(tmp_config = {}) ⇒ Object

Note:

this method will restore the original options after yielding

Temporarily turn Sidekiq’s options into something different

Parameters:

  • tmp_config (Hash<Symbol, Object>) (defaults to: {})

    the temporary config to use



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sidekiq_unique_jobs/testing.rb', line 24

def self.use_options(tmp_config = {})
  old_options = default_worker_options.dup

  default_worker_options.clear
  self.default_worker_options = tmp_config
  yield
ensure
  default_worker_options.clear
  self.default_worker_options = DEFAULT_WORKER_OPTIONS
  self.default_worker_options = old_options
end