imroc / req

Simple Go HTTP client with Black Magic
https://req.cool
MIT License
4.12k stars 334 forks source link

hedged (simultaneous) requests #278

Closed packman80 closed 10 months ago

packman80 commented 10 months ago

It would be great to be able to send multiple simultaneous requests to several urls, but return the fastest response. When it is needed: we have several identical api endpoints, but we need to return the data to the client as quickly as possible. Endpoints can respond at different rates. We send a request to both endpoints, wait for a response from the fastest and return only it. This is an extremely useful pattern in applications where response speed is critical.

imroc commented 10 months ago

I think it’s more appropriate to do this at the business logic