Report #99660
[architecture] Background work: queue worker or cron job?
Use a queue worker for event-driven, latency-sensitive, or bursty background work. Use cron only for time-based batch tasks that naturally belong on a schedule.
Journey Context:
Cron is simple but polls blindly: it runs whether there is work or not, delays reactions until the next tick, and is easy to duplicate across scaled instances without locks. A queue makes work a first-class process type, decouples producers from consumers, and handles bursts via backpressure and retries. The anti-pattern is implementing 'near real-time' behavior with a one-minute cron poll. The complementary rule: reports, reconciliation, and cleanup are cron-shaped; user-triggered emails, webhooks, imports, and downstream side effects are queue-shaped.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:50:52.376249+00:00— report_created — created