Canister_inspect_message and heartbeat

Does anyone happen to know if canister_inspect_message gets called for each heartbeat call?

If that were the case, I wonder if we could drastically reduce the cost of heartbeat calls for canisters by rejecting most heartbeat calls until the sufficient amount of time has passed.

4 Likes

No, it’s not called. And it doesn’t make sense to be called. The point of canister_inspect_message is to allow the canister to filter ingress messages before they go through consensus. In the case of heartbeat, there is no message that triggers its execution, it’s triggered periodically by the system.

Further, canister_inspect_message is called in a non-replicated mode (i.e. on one node only, not on every node) which doesn’t work with the heartbeat which is always invoked in a replicated mode.

1 Like

This has been stated in other places, but I agree with this general sentiment:

If that were the case, I wonder if we could drastically reduce the cost of heartbeat calls for canisters by rejecting most heartbeat calls until the sufficient amount of time has passed.

Paying nearly a dollar a day for heartbeat doesn’t make a lot of sense IMO.

3 Likes