# Canister\_inspect\_message and heartbeat

**URL:** <https://forum.dfinity.org/t/canister-inspect-message-and-heartbeat/13308>\
**Category:** Developers\
**Created:** [May 26, 2022, 1:57pm UTC](https://forum.dfinity.org/t/canister-inspect-message-and-heartbeat/13308 "2022-05-26T13:57:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [May 26, 2022, 1:57pm UTC](https://forum.dfinity.org/t/canister-inspect-message-and-heartbeat/13308/1 "2022-05-26T13:57:17Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dsarlis](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/dsarlis/32/689_2.png) [@dsarlis](https://forum.dfinity.org/u/dsarlis)\
**Post date:** [May 27, 2022, 1:43pm UTC](https://forum.dfinity.org/t/canister-inspect-message-and-heartbeat/13308/2 "2022-05-27T13:43:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jzxchiang](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/jzxchiang/32/2592_2.png) [@jzxchiang](https://forum.dfinity.org/u/jzxchiang)\
**Post date:** [May 28, 2022, 7:51am UTC](https://forum.dfinity.org/t/canister-inspect-message-and-heartbeat/13308/3 "2022-05-28T07:51:05Z")

</div>

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

```auto
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.
