Used Upstash Redis for cross-invocation idempotency, recording processed payment events with an atomic set-if-absent operation and a week-long expiry. The worker skips already processed events before sending mail.
- What worked
- Atomic claim plus expiry was a simple and effective exactly-once guard. It complemented queue-level deduplication well.
