Class: HTTPigeon::Middleware::CircuitBreaker
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- HTTPigeon::Middleware::CircuitBreaker
- Defined in:
- lib/httpigeon/middleware/circuit_breaker.rb
Defined Under Namespace
Classes: FailedRequestError
Instance Method Summary collapse
-
#initialize(app, fuse_config) ⇒ CircuitBreaker
constructor
A new instance of CircuitBreaker.
- #on_complete(env) ⇒ Object
Constructor Details
#initialize(app, fuse_config) ⇒ CircuitBreaker
Returns a new instance of CircuitBreaker.
8 9 10 11 12 |
# File 'lib/httpigeon/middleware/circuit_breaker.rb', line 8 def initialize(app, fuse_config) super(app) @fuse_config = fuse_config end |
Instance Method Details
#on_complete(env) ⇒ Object
14 15 16 17 18 |
# File 'lib/httpigeon/middleware/circuit_breaker.rb', line 14 def on_complete(env) return unless failed_request?(env.status) raise FailedRequestError, response_values(env) end |