motoko-base icon indicating copy to clipboard operation
motoko-base copied to clipboard

Add messageQueueLeft() method to ExperimentalInternetComputer

Open iclighthouse opened this issue 1 year ago • 2 comments

Due to the Message Queue Limit on subnets and canisters, the operation of the contract will be blocked. But the developer can't know when this limit is triggered by the code. So it is suggested to add messageQueueLeft() method to ExperimentalInternetComputer.

messageQueueLeft : () -> { subnet: Nat; canister: Nat }

This would allow application scenarios like the following:

if (ExperimentalInternetComputer.messageQueueLeft().subnet < 100 or ExperimentalInternetComputer.messageQueueLeft().canister < 10) {
    throw Error.reject("Network is busy!");
};

iclighthouse avatar Apr 24 '23 04:04 iclighthouse

Unfortunately, as far as I know, there's no way for us to implement that without further support from the replica/IC System API.

crusso avatar Apr 25 '23 16:04 crusso

Thank you for your reply! IC exposing some key information to Canister will help developers better control the business logic, and hopefully the dfinity foundation will move forward with this internally.

iclighthouse avatar Apr 26 '23 08:04 iclighthouse