class Faraday::Request::Retry

Catches exceptions and retries each request a limited number of times.

By default, it retries 2 times and handles only timeout exceptions. It can be configured with an arbitrary number of retries, a list of exceptions to handle, a retry interval, a percentage of randomness to add to the retry interval, and a backoff factor.

@example Configure Retry middleware using intervals

Faraday.new do |conn|
  conn.request(:retry, max: 2,
                       interval: 0.05,
                       interval_randomness: 0.5,
                       backoff_factor: 2,
                       exceptions: [CustomException, 'Timeout::Error'])

  conn.adapter(:net_http) # NB: Last middleware must be the adapter
end

This example will result in a first interval that is random between 0.05 and 0.075 and a second interval that is random between 0.1 and 0.15.