Module: AsyncCache::Workers::SidekiqWorker::Options

Included in:
AsyncCache::Workers::SidekiqWorker
Defined in:
lib/async_cache/workers/sidekiq.rb

Overview

Pulled out into a module so it can be tested.

Class Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/async_cache/workers/sidekiq.rb', line 12

def self.included(mod)
  if defined?(Sidekiq::Enterprise)
    mod.sidekiq_options unique_for: AsyncCache.options[:uniqueness_timeout]
  elsif defined?(SidekiqUniqueJobs)
    # Only allow one job per set of arguments to ever be in the queue
    mod.sidekiq_options unique: :until_executed
  end
end