Skip to content

fix: schedule in utc - #1

Merged
ab-ioannis merged 1 commit into
mainfrom
fix/schedule-in-utc
Oct 26, 2026
Merged

ab-ioannis merged 1 commit into
mainfrom
fix/schedule-in-utc

Conversation

@ab-ioannis

@ab-ioannis ab-ioannis commented Oct 26, 2026 •

Copy link
Copy Markdown

Changelog

  • Schedule cronjobs in UTC instead of the system's local time.
  • Build the image with cargo install --locked, so it uses the versions in Cargo.lock.
  • README: say that schedules are in UTC.

Why

Schedules were calculated in the system's local time, and at the end of daylight saving time that can make pocketcron hang. In Europe/Amsterdam on 2026-10-25, the cron crate treated 03:00 as a time that happens twice, and its schedule kept cycling between 02:01 and 03:00. The loop in main waits for a run time after "now", which never comes. pocketcron then uses 100% of a CPU core and stops starting jobs. Before it hung, it had also skipped the first of the two 02:00–02:59 hours.

Upgrading cron doesn't help yet: the upstream fix (zslayton/cron#145) isn't in a release, and 0.17.0 hangs the same way. Scheduling in UTC avoids clock changes entirely.

Behaviour change

Crontab times now always mean UTC. On systems that already run in UTC, nothing changes. On other systems, jobs shift by the UTC offset and no longer follow daylight saving time.

cargo install without --locked ignored Cargo.lock and could pick newer dependency versions. The image now builds with the locked versions, which are the ones tested below.

Testing

  • cargo build --locked, cargo fmt --check and cargo clippy are all clean.
  • Replayed the main loop with a simulated clock and TZ=Europe/Amsterdam across 2026-10-25, 2027-03-28 and 2027-10-31: no hang, and every UTC hour got all its runs. The same replay with the old code hangs at 2026-10-25 02:00 UTC.
  • Built the image locally (arm64) and ran a test job with TZ=Europe/Amsterdam: it ran exactly on the minute.

@ab-ioannis
ab-ioannis marked this pull request as ready for review October 26, 2026 09:33
@ab-ioannis ab-ioannis self-assigned this Oct 26, 2026
@ab-ioannis
ab-ioannis merged commit 901da15 into main Oct 26, 2026
1 check passed
@ab-ioannis
ab-ioannis deleted the fix/schedule-in-utc branch October 26, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant