Closed rhymes closed 9 years ago
@ericcj would you like to take a look at this?
@Xavdidtheshadow @adelevie any input on this?
@rhymes nice! My only question is if faraday doesn't retry POST requests by default that's probably for a reason, right? Should we not follow suit?
I don't have strong feelings on it, just playing devil's advocate.
@Xavdidtheshadow it seems too big a behavior to change and anyways the retry mechanism, I guess, was implemented because of how Parse rate limits.
We should aim at freezing the whole thing and release a 1.0 sooner rather than later but if you want to discuss that please open an issue and we shall.
Nah, seems good enough. go ahead and merge at your leisure.
Done
I had to change a few things to make it work.
Faraday::BetterRetry middleware is a slightly modified version of the one shipped with Faraday with the two customizations we had before: logging of retries and the passing along of the number of retries left to the Faraday::ExtendedParseJson middleware.
The communication between the two middleware now it's done with a header because Faraday switched to closed structs to store the environent.
I also re-added in the default exceptions used to retry requests that Faraday has.
The logging and the header are tested. The header is deleted before making the HTTP request so it won't be sent to the server (though it's harmless).
The tests removed in better_retry_test are those that were testing the functionality of the middleware itself which is better tested in the Faraday library now.