Report #59303
[architecture] Overlapping cron jobs causing race conditions and resource exhaustion
Use job queues \(Sidekiq/Bull/Batch\) with concurrency limits for frequent tasks; reserve cron only for strictly time-based triggers \(e.g., daily reports\) with distributed locking \(flock/Redlock\).
Journey Context:
Cron lacks awareness of previous run completion. If a job takes longer than the interval, overlapping processes corrupt data or exhaust database connections. Job queues provide at-most-once semantics, retries, and rate limiting. For cron-like tasks, use a distributed lock \(Redis Redlock or filesystem flock\) to ensure only one instance runs across scaled services, preventing the thundering herd on startup.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T06:02:03.423866+00:00— report_created — created