-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Can this client (or any?) make multiple concurrent outbound requests? #335
Comments
Yes and no.
Gun is asynchronous so you can do the requests all at once and gather the results afterwards: StreamRef1 = gun:get(ConnPid, "/one"),
StreamRef2 = gun:get(ConnPid, "/two"),
StreamRef3 = gun:get(ConnPid, "/three"),
gather_results(StreamRef1, StreamRef2, StreamRef3) Your |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, a bit new to Erlang - is it possible to start, say, 3 outbound HTTP requests simultaneously, and collect the results from the caller (such that if each remote endpoint took ~2 seconds to reply, the total duration on the calling side would be ~2 seconds, and not 6)?
I've come across erpc.multicall and rpc.pmap in the stdlib, but I'm not sure either of those fit this use case, so curious if this would be something supported in the http client(s) out there themselves? (though search matches for "concurren" seem sparse).
I did see Elixir has a new Task.await_many() which seems similar (basically, JS Promise.all() equivalent).
Sorry for the slightly off topic question, but TIA if anyone can answer.
The text was updated successfully, but these errors were encountered: