Report #85854
[architecture] Background job processing using cron jobs with locking issues
Use a task queue \(SQS/RabbitMQ\) for event-driven work; reserve cron only for idempotent time-based batch aggregation where missed runs are acceptable
Journey Context:
Cron creates overlapping execution hazards \(requiring complex distributed locking like 'flock' or database advisory locks\), provides no catch-up mechanism for missed runs during downtime, and prevents horizontal scaling \(all nodes attempt the same job\). Task queues offer backpressure, visibility into pending work, natural load balancing, and exactly-once processing via visibility timeouts. Cron remains correct only for true periodic aggregation \(e.g., nightly rollups\) where the time window itself is the trigger, the computation is idempotent, and missing a window is acceptable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:41:26.313141+00:00— report_created — created