Woot! I really appreciate this small feature! It was kind of a pain to start up a new test project, and at least for me it was just at that threshold of not doing it often enough to warrant spending time automating it, but kicking myself every time I started a new demo project
BTW do you know how reliable this canister heartbeat is?
Would it be reliable enough to use to periodically (say, every day) mint new tokens in an autonomous token canister? For example, to implement an automatic inflation mechanism for a token. This is a use case that is possible in IC but not possible in Ethereum.
But, I’ve just figured out ticks fail silently if you call caller() inside a heartbeat callback. This is why it wasn’t working for me for the first time. I understand why it fails, but you should definitely add an error message.
Btw, ic_cdk_macros::heartbeat also works as expected.
sudo dfx deploy --no-wallet caller
Deploying: caller
All canisters have already been created.
Building canisters...
Installing canisters...
Installing code for canister caller, with canister_id rwlgt-iiaaa-aaaaa-aaaaa-cai
The Replica returned an error: code 5, message: "Wasm module of canister rwlgt-iiaaa-aaaaa-aaaaa-cai is not valid: Wasm module has an invalid function signature. Expected return type [] for 'canister_heartbeat', got [I32]."
I am also running into this problem, I would love to be able to do async code within a heartbeat, such as doing a cross-canister call. I hope the ic_cdk::block_on or spawn will still work