Class: Faraday::Retry::Middleware::Options
- Inherits:
-
Object
- Object
- Faraday::Retry::Middleware::Options
- Defined in:
- lib/faraday/retry/middleware.rb
Overview
Options contains the configurable parameters for the Retry middleware.
Constant Summary collapse
- DEFAULT_CHECK =
->(_env, _exception) { false }
Class Method Summary collapse
Instance Method Summary collapse
- #backoff_factor ⇒ Object
- #exceptions ⇒ Object
- #interval ⇒ Object
- #interval_randomness ⇒ Object
- #max ⇒ Object
- #max_interval ⇒ Object
- #methods ⇒ Object
- #retry_block ⇒ Object
- #retry_if ⇒ Object
- #retry_statuses ⇒ Object
Class Method Details
.from(value) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/faraday/retry/middleware.rb', line 34 def self.from(value) if value.is_a?(Integer) new(value) else super(value) end end |
Instance Method Details
#backoff_factor ⇒ Object
58 59 60 |
# File 'lib/faraday/retry/middleware.rb', line 58 def backoff_factor (self[:backoff_factor] ||= 1).to_f end |
#exceptions ⇒ Object
62 63 64 |
# File 'lib/faraday/retry/middleware.rb', line 62 def exceptions Array(self[:exceptions] ||= DEFAULT_EXCEPTIONS) end |
#interval ⇒ Object
46 47 48 |
# File 'lib/faraday/retry/middleware.rb', line 46 def interval (self[:interval] ||= 0).to_f end |
#interval_randomness ⇒ Object
54 55 56 |
# File 'lib/faraday/retry/middleware.rb', line 54 def interval_randomness (self[:interval_randomness] ||= 0).to_f end |
#max ⇒ Object
42 43 44 |
# File 'lib/faraday/retry/middleware.rb', line 42 def max (self[:max] ||= 2).to_i end |
#max_interval ⇒ Object
50 51 52 |
# File 'lib/faraday/retry/middleware.rb', line 50 def max_interval (self[:max_interval] ||= Float::MAX).to_f end |
#methods ⇒ Object
66 67 68 |
# File 'lib/faraday/retry/middleware.rb', line 66 def methods Array(self[:methods] ||= IDEMPOTENT_METHODS) end |
#retry_block ⇒ Object
74 75 76 |
# File 'lib/faraday/retry/middleware.rb', line 74 def retry_block self[:retry_block] ||= proc {} end |
#retry_if ⇒ Object
70 71 72 |
# File 'lib/faraday/retry/middleware.rb', line 70 def retry_if self[:retry_if] ||= DEFAULT_CHECK end |
#retry_statuses ⇒ Object
78 79 80 |
# File 'lib/faraday/retry/middleware.rb', line 78 def retry_statuses Array(self[:retry_statuses] ||= []) end |