01 · Before and afterThe pattern
// queue time: snapshot
const due = await db.membership.findMany({ where: { planId, status: "approved" } });
for (const e of due) await queue.dispatch({ memberId: e.memberId, planId });
// write time: re-check against current state
const e = await db.membership.findUnique({ where: { memberId } });
if (e?.status !== "approved" || e.planId !== planId) return skip("no longer eligible");
await db.credit.create({ ... });02 · Run it on your appThe check
Do your scheduled payment or credit jobs re-check the member's current status right before they create the money record?
If the honest answer is no or not sure, this is worth a look before it reaches production.