Hmm, I don't immediately see why the `async` version doesn't print.
I believe there's no real difference between putting `sync()` at the end of the
`proc` or after you call it. It's a matter of preference/design.
By the way, it's better not to `discard` `Future` s, because `async` code has a
different semantic for error handling. Any time you call an `async` `proc`, it
will implicitly return a future, which is a "black box" that will eventually
contain a completed result. If you `discard` the `Future` , you will miss the
chance to check for errors. That means you could ignore an exception if one is
thrown. So, instead of using `discard` to handle the future, use `asyncCheck` ,
like this:
echo "executing call number: " , i
asyncCheck callStrategy(i)
Run
The `asyncCheck` procedure adds a callback to the "black box" that re-throws
any exception that might have occurred while the `async` code was running. That
way, you don't miss any errors.
Oh, and I'm wondering why you have an `await` here after the last `echo` :
let response = await client.request("https://reqres.in/api/strategy",
httpMethod = HttpPost,
body = $body)
echo response.status
echo await response.body
Run
I haven't used the Async HTTP module, but I'm wondering if response.body is
just a normal field that can't actually be `await` ed.