Skip to content

Respect configured cron timezone#127

Merged
pufit merged 3 commits into
ClickHouse:mainfrom
fallintoplace:fix/cron-timezone
Jun 23, 2026
Merged

Respect configured cron timezone#127
pufit merged 3 commits into
ClickHouse:mainfrom
fallintoplace:fix/cron-timezone

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

Make cron scheduling honor the configured Nerve timezone instead of the server/container timezone.

Root cause

NerveConfig.timezone was defined and documented, but CronService created APScheduler and cron triggers without passing it through. APScheduler therefore defaulted to the host timezone. context_rotate_at had the same problem because it derived "local" time from the OS timezone.

Changes

  • Create a single ZoneInfo(config.timezone) for cron service scheduling.
  • Pass that timezone to the scheduler, cron triggers, interval triggers, cleanup, wakeup sweep, and source schedules.
  • Use the configured timezone for catch-up crontab checks and daily context rotation times.
  • Add regression tests for scheduler timezone, trigger timezone, catch-up timezone, and context_rotate_at.

Validation

  • python -m pytest tests/test_cron.py -q

fallintoplace and others added 3 commits June 20, 2026 20:42
Resolve conflicts with ClickHouse#138 (_crontab_to_trigger): thread the configured
timezone through the helper at all call sites instead of reverting to
host-tz CronTrigger.from_crontab. Also set config.timezone in the
wakeup-sweep test fixture so CronService.__init__ accepts it.
Re-sync onto latest main (ClickHouse#126 manual cron rotation, ClickHouse#133 sidebar).
service.py auto-merged cleanly: ClickHouse#126's force-rotation logic and ClickHouse#127's
configured-timezone fix coexist in _maybe_rotate_context. Resolved the
additive test conflict by keeping both new rotation tests.
@pufit pufit merged commit 6d96f84 into ClickHouse:main Jun 23, 2026
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.

2 participants