I want to make HTTP requests to some server. Such that the following holds:
- I want data to reach the server as soon as possible.
- I don’t care much about getting the response from the server quickly. Instead, I want the request to block as little as possible.
If I only cared about 1. I would do:
HTTP.post(...)
But it is blocking, so bad for 2. If I only cared about 2. I would do
@async HTTP.post(...
But the scheduler typically does not send these immediately violating 1.
How to have both, send the data immediately but wait for the response in a non-blocking way?