Class: ResilientCall::Configuration
- Inherits:
-
Object
- Object
- ResilientCall::Configuration
- Defined in:
- lib/resilient_call/configuration.rb
Overview
Holds the global defaults and the registry of named profiles.
Instance Attribute Summary collapse
-
#base_wait ⇒ Object
retry.
-
#jitter ⇒ Object
retry.
-
#max_wait ⇒ Object
retry.
-
#on ⇒ Object
retry.
-
#on_failure ⇒ Object
callbacks.
-
#on_retry ⇒ Object
callbacks.
-
#on_success ⇒ Object
callbacks.
-
#profiles ⇒ Object
named profiles registry.
-
#reset_timeout ⇒ Object
circuit breaker.
-
#retries ⇒ Object
retry.
-
#threshold ⇒ Object
circuit breaker.
-
#wait ⇒ Object
retry.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#to_h ⇒ Object
Every default except the profiles registry, ready to be merged in ‘.call`.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/resilient_call/configuration.rb', line 15 def initialize @retries = 3 @wait = :exponential @base_wait = 0.5 @max_wait = 30.0 @jitter = true @on = [StandardError] @threshold = 5 @reset_timeout = 60 @on_retry = nil @on_failure = nil @on_success = nil @profiles = {} end |
Instance Attribute Details
#base_wait ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def base_wait @base_wait end |
#jitter ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def jitter @jitter end |
#max_wait ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def max_wait @max_wait end |
#on ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def on @on end |
#on_failure ⇒ Object
callbacks
11 12 13 |
# File 'lib/resilient_call/configuration.rb', line 11 def on_failure @on_failure end |
#on_retry ⇒ Object
callbacks
11 12 13 |
# File 'lib/resilient_call/configuration.rb', line 11 def on_retry @on_retry end |
#on_success ⇒ Object
callbacks
11 12 13 |
# File 'lib/resilient_call/configuration.rb', line 11 def on_success @on_success end |
#profiles ⇒ Object
named profiles registry
13 14 15 |
# File 'lib/resilient_call/configuration.rb', line 13 def profiles @profiles end |
#reset_timeout ⇒ Object
circuit breaker
9 10 11 |
# File 'lib/resilient_call/configuration.rb', line 9 def reset_timeout @reset_timeout end |
#retries ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def retries @retries end |
#threshold ⇒ Object
circuit breaker
9 10 11 |
# File 'lib/resilient_call/configuration.rb', line 9 def threshold @threshold end |
#wait ⇒ Object
retry
7 8 9 |
# File 'lib/resilient_call/configuration.rb', line 7 def wait @wait end |
Instance Method Details
#to_h ⇒ Object
Every default except the profiles registry, ready to be merged in ‘.call`.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/resilient_call/configuration.rb', line 34 def to_h { retries: @retries, wait: @wait, base_wait: @base_wait, max_wait: @max_wait, jitter: @jitter, on: @on, threshold: @threshold, reset_timeout: @reset_timeout, on_retry: @on_retry, on_failure: @on_failure, on_success: @on_success } end |