Class: Faraday::Request::Retry
- Inherits:
-
Middleware
- Object
- Middleware
- Faraday::Request::Retry
- Defined in:
- lib/faraday/request/retry.rb
Instance Method Summary (collapse)
- - (Object) call(env)
-
- (Retry) initialize(app, retries = 2)
constructor
A new instance of Retry.
Methods inherited from Middleware
dependency, inherited, loaded?, new
Methods included from MiddlewareRegistry
#lookup_middleware, #register_middleware
Constructor Details
- (Retry) initialize(app, retries = 2)
A new instance of Retry
3 4 5 6 |
# File 'lib/faraday/request/retry.rb', line 3 def initialize(app, retries = 2) @retries = retries super(app) end |
Instance Method Details
- (Object) call(env)
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/faraday/request/retry.rb', line 8 def call(env) retries = @retries begin @app.call(env) rescue StandardError, Timeout::Error if retries > 0 retries -= 1 retry end raise end end |