Report #101039
[architecture] Should scheduled background work run directly from cron or through a job queue?
Use cron only to enqueue jobs into a durable queue; never let cron execute the work directly. Separate scheduling \(when work is triggered\) from execution \(who processes it, where, and how\).
Journey Context:
Cron couples trigger time and execution in one process. On a single server that is fine, but as soon as a job runs long, cron overlaps instances; if the server dies, work is lost; if you scale horizontally, multiple crons race and duplicate work. The Heroku pattern is a lightweight clock process that schedules jobs into a queue, while stateless workers perform the actual processing. This gives retries, visibility, independent scaling, and natural idempotency. Many teams try to 'just add a cron' and end up reinventing a queue with bash locks and log grepping. The rule is simple: cron decides timing; the queue decides execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-06T04:52:47.357721+00:00— report_created — created