If I have something like this, and I call test, will the async call to test_2 be made?
#[update]
async fn test() {
println!("test was called");
ic_cdk::spawn(async move {
let _: () = ic_cdk::call(ic_cdk::api::id(), "test_2", ()).await.unwrap();
});
panic!("Panic at the disco!");
}
#[update]
async fn test_2() {
println!("Playground canister test_2 was called");
}
I was able to run this with a
StateMachinetest:I got the following output:
It appears that panicking prevents the
spawncall from finishing execution, as the state is rolled back after panic (and part of the state was that the call was going to run later).