Skip to content

.tip

· one of the small things

Put the id in the job, not a copy of the row

A job that carries a copy of the row runs on data from enqueue time. If the queue is ten minutes behind, the receipt goes to the address the user just changed, and every retry resends the stale copy.

await enqueue("send_receipt", { orderId: order.id });
// worker: read it again, fresh
const order = await db.order.findUniqueOrThrow({ where: { id: job.orderId } });

Small payloads also keep personal data out of the queue and out of the dead letter table. Send a value only when the job must act on that exact version, like the amount that was charged.

queuesreliability