-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retry middleware fails in parallel #2
Comments
Thanks for raising this @BuonOmo, it does indeed look like something we should fix! My guess is that those middleware have been written before the parallel feature, and were never updated after that. It would be awesome if you could work on this, but please feel free to shout out if you need any help! |
Unfortunately, it would still be deceiving because the durations would pile up. require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "faraday"
gem "typhoeus"
gem "activesupport", require: "active_support"
end
faraday = Faraday.new do |conn|
conn.request :instrumentation
conn.adapter :typhoeus
end
ActiveSupport::Notifications.subscribe('request.faraday') do |name, starts, ends, _, env|
url = env[:url]
http_method = env[:method].to_s.upcase
duration = ends - starts
$stdout.puts '[%s] %s %s (%.3f s)' % [url.host, http_method, url.request_uri, duration]
end
faraday.in_parallel(Typhoeus::Hydra.new(max_concurrency: 1)) do
100.times {faraday.get("https://httpbin.org/status/200")}
end
Hence we would need timing information, which is already given by ethon and typhoeus, however faraday does not give access to the wrapper request or response, nor it has request timing information. Hence I think it would be wise to let you choose how do you want this information to be accessible, since I really don't have the whole adapter design in mind..
Ok thanks for the hint I'll look into that, I'm more confident on that one since it is clearly scoped 🙂 |
Mmmmh that's interesting, my guess is that's because |
Basic Info
Issue description
The retry count middleware does not wait for completed requests when in parallel, hence retries are not issued.
Steps to reproduce
Fix
Note that I already found a fix working locally for typhoeus, I would just like to know if that's a bug for you and I spend my time wisely making it work in every cases! (I think the tricky part will concern chaining with the raise middleware)
Here's a working patch for the precise reproduction above:
If you're in I should be able to get that done within 2 weeks
Bonus
Note that the instrumentation middleware has basically the same issue, I can fix it with
One issue though, the time (ends - starts) would be wrong, and I see that faraday does not add the request time to env data..
The text was updated successfully, but these errors were encountered: