module SidekiqUniqueJobs::OnConflict

Provides lock conflict resolutions

@author Mikael Henriksson <mikael@mhenrixon.com>

Public Class Methods

find_strategy(strategy) click to toggle source

Find a strategy to use for conflicting locks

@param [Symbol] strategy the key for the strategy

@return [OnConflict::Strategy] when found @return [OnConflict::NullStrategy] when no other could be found

# 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
strategies() click to toggle source

A convenience method for using the configured strategies

# File lib/sidekiq_unique_jobs/on_conflict.rb, line 19
def self.strategies
  SidekiqUniqueJobs.strategies
end