motoko-base
motoko-base copied to clipboard
Add messageQueueLeft() method to ExperimentalInternetComputer
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!");
};
Unfortunately, as far as I know, there's no way for us to implement that without further support from the replica/IC System API.
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.