Back to Coding agent workspace
fieldwork/notifications/Review
Fix duplicate reminders
fix/reminder-retriesRevision 1Needs a fixTask & activity
- MCMaya Chen9:12 AM
Make sure a retry never sends the same reminder twice.
- ✦Rune9:18 AM
The send now carries a dedupe key. The retry test still fails because its job ID changes. The diff and test output are ready to review.
Prepared a patch
Resultsrc/reminders/deliver.ts test/reminders.test.ts
Ran the test suite
ResultPASS Sends a scheduled reminder FAIL Uses the same key on retry PASS Skips a reminder with a receipt
2 passed · 1 failed
deliver.ts
+2−2| 1 | 1 | export async function deliver(job: Reminder) { | |
| 2 | − | ||
| 2 | + | const key = deliveryKey(job.id) | |
| 3 | 3 | if (await receipts.has(key)) return | |
| 4 | 4 | ||
| 5 | − | ||
| 5 | + | await mail.send(render(job), { key }) | |
| 6 | 6 | await receipts.put(key) | |
| 7 | 7 | } |