Method: Faraday::Request::Retry#initialize

Defined in:

#initialize(app, options = nil) ⇒ Retry

Public: Initialize middleware

Options: max - Maximum number of retries (default: 2) interval - Pause in seconds between retries (default: 0) interval_randomness - The maximum random interval amount expressed

as a float between 0 and 1 to use in addition to the
interval. (default: 0)

max_interval - An upper limit for the interval (default: Float::MAX) backoff_factor - The amount to multiple each successive retry's

interval amount by in order to provide backoff
(default: 1)

exceptions - The list of exceptions to handle. Exceptions can be

given as Class, Module, or String. (default:
[Errno::ETIMEDOUT, Timeout::Error,

methods - A list of HTTP methods to retry without calling retry_if. Pass

an empty Array to call retry_if for all exceptions.
(defaults to the idempotent HTTP methods in IDEMPOTENT_METHODS)

retry_if - block that will receive the env object and the exception raised

and should decide if the code should retry still the action or
not independent of the retry count. This would be useful
if the exception produced is non-recoverable or if the
the HTTP method called is not idempotent.
(defaults to return false)

# File 'lib/faraday/request/retry.rb', line 97

def initialize(app, options = nil)
  @options = Options.from(options)
  @errmatch = build_exception_matcher(@options.exceptions)