Class: Resque::JobChain::Configuration
- Inherits:
-
Object
- Object
- Resque::JobChain::Configuration
- Defined in:
- lib/resque/job_chain/configuration.rb
Instance Attribute Summary collapse
-
#completed_chain_ttl ⇒ Integer
TTL in seconds for completed chain state in Redis.
-
#default_max_attempts ⇒ Integer
Default max retry attempts for the :retry strategy.
-
#default_strategy ⇒ Symbol
Default error strategy (:abort, :retry, :skip).
-
#logger ⇒ #info, ...
Optional logger for chain lifecycle events.
-
#statsd_client ⇒ #increment, ...
Optional StatsD-compatible client.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #observers_for(event) ⇒ Object
- #on(event, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 |
# File 'lib/resque/job_chain/configuration.rb', line 19 def initialize @default_strategy = :abort @default_max_attempts = 3 @completed_chain_ttl = 86_400 @statsd_client = nil @logger = nil @observers = Hash.new { |h, k| h[k] = [] } end |
Instance Attribute Details
#completed_chain_ttl ⇒ Integer
Returns TTL in seconds for completed chain state in Redis.
11 12 13 |
# File 'lib/resque/job_chain/configuration.rb', line 11 def completed_chain_ttl @completed_chain_ttl end |
#default_max_attempts ⇒ Integer
Returns Default max retry attempts for the :retry strategy.
8 9 10 |
# File 'lib/resque/job_chain/configuration.rb', line 8 def default_max_attempts @default_max_attempts end |
#default_strategy ⇒ Symbol
Returns Default error strategy (:abort, :retry, :skip).
5 6 7 |
# File 'lib/resque/job_chain/configuration.rb', line 5 def default_strategy @default_strategy end |
#logger ⇒ #info, ...
Returns Optional logger for chain lifecycle events.
17 18 19 |
# File 'lib/resque/job_chain/configuration.rb', line 17 def logger @logger end |
#statsd_client ⇒ #increment, ...
Returns Optional StatsD-compatible client.
14 15 16 |
# File 'lib/resque/job_chain/configuration.rb', line 14 def statsd_client @statsd_client end |
Instance Method Details
#observers_for(event) ⇒ Object
32 33 34 |
# File 'lib/resque/job_chain/configuration.rb', line 32 def observers_for(event) @observers[event.to_sym] end |
#on(event, &block) ⇒ Object
28 29 30 |
# File 'lib/resque/job_chain/configuration.rb', line 28 def on(event, &block) @observers[event.to_sym] << block end |