← Back to library

避免 `nextRunAtMs` 前移导致 cron 漏跑

解决周期任务偶发漏执行:对高频 cron 做压测并核对 nextRunAt 推进逻辑,确保每个到期窗口都被消费。

GITHUBDiscovered 2026-02-13Author WalterSumbon
Prerequisites
  • Cron scheduler is enabled and `cron runs` history is queryable.
  • You can create a temporary high-frequency job in non-production scope.
Steps
  1. Create a test cron job with short interval (e.g., every 1-2 minutes) and fixed payload text.
  2. Run scheduler under load and capture `nextRunAtMs` transitions in logs.
  3. Compare expected trigger count vs `cron runs` history to detect skipped windows.
  4. Add alerting when job delay exceeds threshold to catch future regressions early.
Commands
openclaw gateway status
openclaw logs --local-time
openclaw help
Verify

Actual run count matches expected count in stress window, with no unexplained gaps.

Caveats
  • Clock skew or host suspend can still affect schedule semantics and must be monitored separately.
  • Detailed PR discussion may require authenticated GitHub view(需验证)。
Source attribution

This tip is aggregated from community/public sources and preserved with attribution.

Open original source ↗
Visit original post