-
Sorry to use GitHub issues for a question (happy to turn this into a documentation PR if applicable!), but I'm struggling to understand the difference between using this adapter with Faraday, vs using "plain" https://github.com/socketry/async with Faraday. The Async do
response1 = Async{adapter.get("/index")}
response2 = Async{adapter.get("/index")}
response3 = Async{adapter.get("/index")}
puts response1.wait.body # => "Hello World"
puts response2.wait.body # => "Hello World"
puts response3.wait.body # => "Hello World"
end I'm having trouble understanding how this relates to the faraday adapter and what the difference is from using just https://github.com/socketry/async? Put differently, what is the difference between these three examples? 1. Set
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Thanks for the question! Here's how these approaches differ: 1. Using
|
Beta Was this translation helpful? Give feedback.
Thanks for the question! Here's how these approaches differ:
1. Using
async_http
as the Faraday adapter, without anAsync
blockEach request happens one after the other, and the adapter sets up its own reactor for every request. This means you’re not getting concurrency or persistent connections. Even though you’re using the async adapter, it’s essentially behaving synchronously.
2. Using
async_http
inside anAsync
block