Class: ActiveJob::Uniqueness::Configuration
- Inherits:
-
Object
- Object
- ActiveJob::Uniqueness::Configuration
- 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
- #on_conflict=(action) ⇒ Object
- #on_redis_connection_error=(action) ⇒ Object
- #validate_on_conflict_action!(action) ⇒ Object
- #validate_on_redis_connection_error!(action) ⇒ Object
Instance Method Details
#on_conflict=(action) ⇒ Object
27 28 29 30 31 |
# File 'lib/active_job/uniqueness/configuration.rb', line 27 def on_conflict=(action) validate_on_conflict_action!(action) config.on_conflict = action end |
#on_redis_connection_error=(action) ⇒ Object
39 40 41 42 43 |
# File 'lib/active_job/uniqueness/configuration.rb', line 39 def on_redis_connection_error=(action) validate_on_redis_connection_error!(action) config.on_redis_connection_error = action end |
#validate_on_conflict_action!(action) ⇒ Object
33 34 35 36 37 |
# File 'lib/active_job/uniqueness/configuration.rb', line 33 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 |
#validate_on_redis_connection_error!(action) ⇒ Object
45 46 47 48 49 |
# File 'lib/active_job/uniqueness/configuration.rb', line 45 def validate_on_redis_connection_error!(action) return if action.nil? || action == :raise || action.respond_to?(:call) raise ActiveJob::Uniqueness::InvalidOnConflictAction, "Unexpected '#{action}' action on_redis_connection_error" end |