This crate provides a library to schedule multiple and periodic tasks on the Internet Computer.
In Cargo.toml
:
[dependencies]
ic-cdk-timers = "0.9.0"
To schedule a one-shot task to be executed 1s later:
ic_cdk_timers::set_timer(Duration::from_secs(1), || ic_cdk::println!("Hello from the future!"));
- Internet Computer Developer Guide: Periodic Tasks and Timers
- Example: Periodic Tasks and Timers (compares timers and heartbeats).