Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Update periodic_tasks example to ic-cdk-timers v1.0.0 API

Open
#1,314 0 comments 0 reactions 0 assignees View on GitHub

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

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-cdk 0.12 → 0.19
  • ic-cdk-macros 0.8 → current
  • ic-cdk-timers 0.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-macros versions
Project-level
  • dfx.json at project root — should be migrated to icp.yaml

References

Dominant language
Rust
Stars
612
Forks
432
Avg merge
15h 51m
Merged PRs (30d)
7

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dfinity/examples

All issues in dfinity/examples

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.