Class: Admincredible::Middleware::Request::Step
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Admincredible::Middleware::Request::Step
- Defined in:
- lib/admincredible/middleware/step.rb
Overview
TODO:
Fix this for OAuth
Akeeba powered restoration scripts use a step/ping methodology that avoids timing out servers. This will automatically send more requests when a step response is received.
It sadly doesn’t work with OAuth yet because the re-signing requests problem was too difficult for this dev too solve at the time of this writing.
If many months pass before this is resolved you can blame the developer’s intense devotion to getting other things done. You can probably motivate him to fix it for oauth by bribing him with books.
Constant Summary collapse
- DEFAULT_RETRY_AFTER =
1
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Step
constructor
A new instance of Step.
Constructor Details
#initialize(app, options = {}) ⇒ Step
Returns a new instance of Step.
21 22 23 |
# File 'lib/admincredible/middleware/step.rb', line 21 def initialize(app, ={}) super(app) end |
Instance Method Details
#call(env) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/admincredible/middleware/step.rb', line 25 def call(env) response = @app.call(env) if response.env[:status] == 202 seconds_left = DEFAULT_RETRY_AFTER seconds_left.times do |i| sleep 1 end call(env) else response end end |