Keyworder : ignore

Keyword: ignore calls other canister. Can It ensure that the call must be executed by other canister.
public func test() : async() {
let userCanister = await userCanister.userCanister();
ignore userCanister.print(“record”);

}

userCanister It will be implemented print ??Is there a possibility that userCanisters may not receive messages and not execute print

Using ignore does not affect the way a message is sent, it merely throws away the result (more generally, ignore is independent from message sends, it just throws away a value).

In principle, message sends can always fail, e.g., because the canister is down. However, if you await the result of the message then you’ll be notified with an exception locally, whereas without await you won’t get an exception.

So, await is what’s relevant wrt detecting failure, not ignore. For example:

let x = await foo.bar();  // raises exception if message fails
let y = foo.bar();        // does not raise exception, unless you await y later
ignore foo.bar();         // does not raise exception
ignore await foo.bar();   // raises exception, otherwise ignores result

It may help to know that ignore effectively is just a shorthand for let _ =.

2 Likes