# Async calls on IC

**URL:** <https://forum.dfinity.org/t/async-calls-on-ic/22577>\
**Category:** Developers\
**Created:** [September 6, 2023, 6:14am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577 "2023-09-06T06:14:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dustin](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@Dustin](https://forum.dfinity.org/u/Dustin)\
**Post date:** [September 6, 2023, 6:14am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/1 "2023-09-06T06:14:43Z")

</div>

I’ve got two questions regarding async calls in Rust.

1. What happens if inter-canister update calls are not awaited by the sender? Can they be sent in a “send and forget” kind of way?
2. Is it possible that no response at all is received during an inter-canister update call that is awaited? I have a case where I call another canister with `ic_cdk::call()` and `await` the response but I don’t seem to be receiving anything, not even an `Err` response from the `CallResult` or any timeout. Is that possible?

---

<div class="post-metadata">

**Author:** ![free](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/free/32/615_2.png) [@free](https://forum.dfinity.org/u/free)\
**Post date:** [September 6, 2023, 3:47pm UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/2 "2023-09-06T15:47:12Z")

</div>

Rust futures (what you get from “calling” an `async fn`) don’t do anything unless you `await` them. They’re similar to defining something like `let f = |i| println!("{}", i);` and then never calling `f(n)`. So that’s exactly what would happen with a canister call that you never await: it wouldn’t be made.

At the protocol level, every request produces a response, whether it’s a response from the callee; or a reject response from the system (e.g. “not enough cycles”).

You can have your request handler produce a response before you’ve awaited all (or any of) the calls you made. But in order for the calls to be made at all, you need to await them. And if you do make / await them, the call context will be open until they all produce a response.

---

<div class="post-metadata">

**Author:** ![Dustin](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@Dustin](https://forum.dfinity.org/u/Dustin)\
**Post date:** [September 7, 2023, 7:37am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/3 "2023-09-07T07:37:41Z")

</div>

Thanks for the clarification!

1. Ok, this makes sense and helps.
2. I’ve figured out the problem on my end. I didn’t define the expected `Reponse` payload correctly because I was missing one element of an `enum` type and it caused the call to fail and the entire execution to trap.

---

<div class="post-metadata">

**Author:** ![benji](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/benji/32/8069_2.png) [@benji](https://forum.dfinity.org/u/benji)\
**Post date:** [September 7, 2023, 9:09am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/4 "2023-09-07T09:09:23Z")

</div>

Note that there’s also `ic_cdk::notify` if you don’t want to await.

---

<div class="post-metadata">

**Author:** ![free](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/free/32/615_2.png) [@free](https://forum.dfinity.org/u/free)\
**Post date:** [September 7, 2023, 9:44am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/5 "2023-09-07T09:44:11Z")

</div>

Indeed. My knowledge of the CDK is rather limited and it shows.

Do note, however, that while `ic_cdk::notify` will (try to) deliver a request to the callee without requiring the caller to wait for the response (so the update call may complete before a response is delivered), at the protocol level this is not a one-way canister call (because the protocol does not support anything of the sort). So the canister itself will still have an open call context waiting for the response (which, among other things, means that the canister cannot be stopped before the response is received).

---

<div class="post-metadata">

**Author:** ![benji](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/benji/32/8069_2.png) [@benji](https://forum.dfinity.org/u/benji)\
**Post date:** [September 7, 2023, 9:58am UTC](https://forum.dfinity.org/t/async-calls-on-ic/22577/6 "2023-09-07T09:58:39Z")

</div>

Oh I did not know about the hidden open call context. Thanks for clarifying!
