Class: ActiveJob::Uniqueness::Configuration

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Configurable
Defined in:
lib/active_job/uniqueness/configuration.rb

Overview

Use /config/initializer/activejob_uniqueness.rb to configure ActiveJob::Uniqueness

ActiveJob::Uniqueness.configure do |c|

c.lock_ttl = 3.hours

end

Instance Method Summary collapse

Instance Method Details

#on_conflict=(action) ⇒ Object



26
27
28
29
30
# File 'lib/active_job/uniqueness/configuration.rb', line 26

def on_conflict=(action)
  validate_on_conflict_action!(action)

  config.on_conflict = action
end

#validate_on_conflict_action!(action) ⇒ Object



32
33
34
35
36
# File 'lib/active_job/uniqueness/configuration.rb', line 32

def validate_on_conflict_action!(action)
  return if action.nil? || %i[log raise].include?(action) || action.respond_to?(:call)

  raise ActiveJob::Uniqueness::InvalidOnConflictAction, "Unexpected '#{action}' action on conflict"
end