Module: SidekiqUniqueJobs::OnConflict

Defined in:
lib/sidekiq_unique_jobs/on_conflict.rb,
lib/sidekiq_unique_jobs/on_conflict/log.rb,
lib/sidekiq_unique_jobs/on_conflict/raise.rb,
lib/sidekiq_unique_jobs/on_conflict/reject.rb,
lib/sidekiq_unique_jobs/on_conflict/replace.rb,
lib/sidekiq_unique_jobs/on_conflict/strategy.rb,
lib/sidekiq_unique_jobs/on_conflict/reschedule.rb,
lib/sidekiq_unique_jobs/on_conflict/null_strategy.rb

Overview

Provides lock conflict resolutions

Author:

Defined Under Namespace

Classes: Log, NullStrategy, Raise, Reject, Replace, Reschedule, Strategy

Class Method Summary collapse

Class Method Details

.find_strategy(strategy) ⇒ OnConflict::Strategy, OnConflict::NullStrategy

Find a strategy to use for conflicting locks

Parameters:

  • strategy (Symbol)

    the key for the strategy

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/sidekiq_unique_jobs/on_conflict.rb', line 31

def self.find_strategy(strategy)
  return OnConflict::NullStrategy unless strategy

  strategies.fetch(strategy.to_sym) do
    SidekiqUniqueJobs.logger.warn(
      "No matching implementation for strategy: #{strategy}, returning OnConflict::NullStrategy." \
      " Available strategies are (#{strategies.inspect})",
    )

    OnConflict::NullStrategy
  end
end

.strategiesObject

A convenience method for using the configured strategies



19
20
21
# File 'lib/sidekiq_unique_jobs/on_conflict.rb', line 19

def self.strategies
  SidekiqUniqueJobs.strategies
end