When using Net::HTTP
as adapter, users get surprised by the retry strategy provided by Net::HTTP
. This brings to different "issues" (e.g. #612 and #771).
There's not much we can do for Ruby <= 2.4, however Ruby 2.5 provides a new max_retries
config for Net::HTTP
so Faraday should set that automatically when available.
See issues #612 and #771.
I've been looking at this issue. One approach mentioned in #771 is to set the default to 0, but change it depending on the amount of retries configured. We would have to make the Retry middleware aware of the underlying adapter (as some adapters might not support this), and conditionally apply this logic in the env
. The adapter would also have to know about the amount of retries.
As an alternative to said approach, we can set it to do no retries, instead keeping the retry logic confined to the Retry middleware. Whatever the outcome, I'd be more than happy to pick this up @iMacTia .
I was definitely thinking at the second option.
We already have the Retry middleware that can take care of retrying failed requests.
Adapters (in this case Net::HTTP) should never retry requests on their own.
All we need to do in this case is to tell Net::HTTP adapter to set max_retries
to 0, if this property is available, of course
@iMacTia - I couldn't agree more. In that case, I shall pick this up.