Report #8132
[architecture] Should I use a cron job or a job queue for recurring background tasks
Use cron only for simple, idempotent, fire-and-forget maintenance tasks \(log rotation, temp cleanup\) that can tolerate overlapping runs; use a proper job queue \(Bull, Sidekiq, Celery\) for business-critical work, implementing distributed locks or unique job constraints to prevent overlapping executions during high latency.
Journey Context:
Cron appears simpler but fails catastrophically under real-world conditions: overlapping runs when a job takes longer than its interval, no native retry mechanism for failures, and 'distributed cron' requires complex leader election \(every server runs the cron unless coordinated\). Queues provide ack/nack, dead-letter queues for poison pills, visibility timeouts, and horizontal scaling. The trap is using cron for 'send daily email digest' which becomes a nightmare when you scale to millions of users and need to shard the work across workers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T04:43:21.848736+00:00— report_created — created