Redis + BullMQ for AI Workloads: Retries Are Not Enough — You Also Need Idempotency and Ordering
Moving AI analysis out of an HTTP request improves the request path. Queueing that work does not make it correct. In my AI Support Assistant, a new message triggers BullMQ analysis of the ticket conversation. The request waits for database writes and queue publication, then returns without waiting for the AI results. But a retryable job can still run more than once, reload different context, race…
In AI-powered support systems, queueing work using BullMQ does not guarantee correctness. While a message is saved and queue publication occurs, the AI analysis job can still run multiple times, causing issues such as loading different context, racing with other jobs, repeating provider work, or overwriting newer results. The message itself does not provide idempotency or guarantee ordering of execution.
The worker processes the AI summary, sentiment, and priority for a ticket based on the ticket ID, with no attachment to job identity or conversation version. This can lead to concurrent jobs running simultaneously for the same ticket, potentially causing inconsistent updates to the ticket and AI interaction records. Simply implementing retries does not solve these correctness issues, as the process lacks proper idempotency and ordering mechanisms.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.