Files
flyer-crawler.projectium.com/docs/adr/0006-background-job-processing-and-task-queues.md
Torben Sorensen d004efb84b
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 16m21s
testing ADR - architectural decisions
2025-12-12 10:57:49 -08:00

1.0 KiB

ADR-006: Background Job Processing and Task Queues

Date: 2025-12-12

Status: Proposed

Context

The application's core purpose involves long-running, resource-intensive tasks like OCR processing of flyers. Executing these tasks within the lifecycle of an API request is unreliable and does not scale. A failure during processing could be lost without a robust system.

Decision

We will implement a dedicated background job processing system using a task queue library like BullMQ (with Redis). All flyer ingestion, OCR processing, and other long-running tasks (e.g., sending bulk emails) MUST be dispatched as jobs to this queue.

Consequences

Positive: Decouples the API from heavy processing, allows for retries on failure, and enables scaling the processing workers independently. Increases application reliability and resilience. Negative: Introduces a new dependency (Redis) into the infrastructure. Requires refactoring of the flyer processing logic to work within a job queue structure.