Update periodic_tasks example to ic-cdk-timers v1.0.0 API
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- rust
- Domain
- backend, build-system
Research direction
Start with rust/periodic_tasks/timer/Cargo.toml and src/lib.rs, then inspect heartbeat/Cargo.toml and the project-root dfx.json. Compare the timer code with the ic-cdk-timers v1.0.0 changelog and verify the documented API and CLI references. Done means both examples use the requested dependency versions and API, doc comments use icp, and the project configuration is migrated to icp.yaml.
Written by the indexing model from the issue text.
Description
Problem
The rust/periodic_tasks/timer example uses ic-cdk-timers = "0.6" and the old closure-based API. The ic-cdk-timers v1.0.0 release (2025-11-13) introduced breaking changes to function signatures.
What needs updating
Dependencies (timer/Cargo.toml)
ic-cdk0.12→0.19ic-cdk-macros0.8→ currentic-cdk-timers0.6→1.0
Code (timer/src/lib.rs)
set_timer_interval signature changed — now takes FnMut() -> impl Future instead of FnOnce():
// Old (line 71):
let timer_id = ic_cdk_timers::set_timer_interval(secs, periodic_task);
// New:
let timer_id = ic_cdk_timers::set_timer_interval(secs, || async { periodic_task() });
ic_cdk::spawn() comment is obsolete (lines 75-77) — set_timer now takes futures directly, no spawn wrapper needed.
dfx references in doc comments (lines 53, 65, 82, 96) — dfx is deprecated, should use icp CLI.
Heartbeat example (heartbeat/Cargo.toml)
- Same outdated
ic-cdk/ic-cdk-macrosversions
Project-level
dfx.jsonat project root — should be migrated toicp.yaml
References
- ic-cdk-timers v1.0.0 changelog
- Found while updating developer-docs PR #9 (timers guide)
- Dominant language
- Rust
- Stars
- 612
- Forks
- 432
- Avg merge
- 15h 51m
- Merged PRs (30d)
- 7
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dfinity/examples
-
Difficulty 4/5 3-5 days Newbie friendliness 70/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in dfinity/examples
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
app enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
elodin-sys/elodin#890 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
guidance-ai/llguidance#391 ·