Clarity on `ic_cdk::api::call::notify`

I’m hoping someone can clarify on the documentation here.

Which states…

Returns Ok(()) if the message was successfully enqueued, otherwise returns a reject code.

And then proceeds to state

The caller has no way of checking whether the destination processed the notification. The system can drop the notification if the destination does not have resources to process the message (for example, if it’s out of cycles or queue slots).

Does an Ok response mean the message was successfully enqueued at the destination canister. Or, something else like that it was successfully enqueued to be sent?

1 Like

If Ok is returned, i.e. if ic0.call_perform returned 0, then the message was successfully enqueued and will not be dropped due to a lack of resources.

2 Likes

Thank you so much Adam :slight_smile:

There are two types of resources: resources of the caller and resources of the destination.
If notify returned Ok(), this means that the caller has enough cycles and queue slots to send out the message. With the current implementation, it’s almost always true that the destination will have enough queue slots to receive the message (thanks to the mechanism called backpressure), but it might become not true in the future if we introduce true one-way calls. Also, if the destination ran out of cycles, the sender won’t know.

2 Likes

@roman-kashitsyn - could you elaborate a bit more on the backpressure behavior? As I understand, it’s not possible to inspect a canisters queue, which is a concern for us.