-
Notifications
You must be signed in to change notification settings - Fork 966
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
What do you want in Faraday 1.0? #202
Comments
👍 |
I think separate request/response stacks are interesting and worth exploring. I would definitely start with a subset of that idea and just extract adapters out of this whole things as endpoints not middleware (#47) which also makes them easily swappable (common pitfall), ensures that they don't end up elsewhere that is not at the end of middleware stack (common pitfall) and makes some implementation code simpler. I'm going to do this soon in a backwards-compatible manner. |
I took a completely different approach and broke away from Rack completely: #207 It slaughters backwards compatibility, but I really like how simpler the middleware (now called callbacks) and adapters are. |
I don't know if faraday is the layer for this but i'd like a futures/promise based interface for making http requests. ie, i call This would make it fairly easy to make several http requests at the same time. All that would be required is to just make one call right after another. The gory details are hidden so that clients that don't need/want concurrent requests could carry on as if the requests where made synchronously. |
@pezra: That's currently possible with Typhoeus, and maybe EM? You need to make a batch of requests with the same parallel manager (which is the Hydra object in Typhoeus 0.4, and something else in Typhoeus 0.5). I'm really hoping that I can get it to work with the new builder stuff. It's one of my required features before I merge that branch into master. |
Typhoeus and EM handle concurrency quite differently (and sort of awkwardly, imo). In Typhoeus, if i understand it correctly, you must define all the requests you want to run in parallel in a single block and none of the responses are available until all have completed. This introduces unnecessary latency for short requests in a batch. It also requires that you reorganize your code in order to use this feature. With EM you need to get involved in the whole async io quagmire to accomplish this. :) The goal of a futures based approach is that it would provide improved latency for http requests in a transparent and comfortably OO way. In the best case doing exactly what is done now goes a lot faster and in the worst case the performance is unchanged. This could be implemented above the faraday level but i thought i'd throw it out there to see if it has legs. |
I would like to see some support for Digest Auth: https://github.com/technoweenie/faraday/issues/109 :) |
@pezra @technoweenie You still do async requests with request = Typhoeus::Request.new("www.exmple.com")
request.on_complete{ |response| p "completed" }
hydra = Typhoeus::Hydra.new
hydra.queue(request)
hydra.run
#=> "completed" That way you don't have to wait until the Hydra#run returns. |
I vote for persistent connections? Looking at the net-http-persistent adapter it seems to recreate create the connection for every request. |
@ismell It may appear so, but it doesn't. All instances of NHPersistent use the same connection pool. |
Oh well good to know :) Thanks! |
Maybe convenient method for constructing a connection pool using |
A in-depth tutorial! |
Closing in favour of #620 |
The text was updated successfully, but these errors were encountered: