Class: Request::Retry
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Request::Retry
- Defined in:
- lib/gh/faraday.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, retries = 2) ⇒ Retry
constructor
A new instance of Retry.
Constructor Details
#initialize(app, retries = 2) ⇒ Retry
Returns a new instance of Retry.
48 49 50 51 |
# File 'lib/gh/faraday.rb', line 48 def initialize(app, retries = 2) @retries = retries super(app) end |
Instance Method Details
#call(env) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/gh/faraday.rb', line 53 def call(env) retries = @retries begin @app.call(env) rescue StandardError, Timeout::Error if retries > 0 retries -= 1 retry end raise end end |