Class: Attune::CallDropping
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Attune::CallDropping
- Defined in:
- lib/attune/call_dropping.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, storage = default_storage) ⇒ CallDropping
constructor
A new instance of CallDropping.
Constructor Details
#initialize(app, storage = default_storage) ⇒ CallDropping
Returns a new instance of CallDropping.
3 4 5 6 |
# File 'lib/attune/call_dropping.rb', line 3 def initialize app, storage=default_storage @app = app @storage = storage end |
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/attune/call_dropping.rb', line 8 def call env raise_timeout if should_skip? begin result = @app.call(env) increment_skips(-SKIP_STEP) result rescue Faraday::Error::TimeoutError => e increment_skips(SKIP_STEP) raise e end end |