3 ms·
> Also, hopefully the API you use to send email has a way to avoid duplicate emails, perhaps by attaching a unique ID to the request that's used to detect dupli
by vsroy 5y ago
> Also, hopefully the API you use to send email has a way to avoid duplicate emails, perhaps by attaching a unique ID to the request that's used to detect duplicate sends.
I think this is the interesting part. Storing a value in the table to be processed by a queue seems normal / not rocket science. But what happens when we
1. Call the API
2. The API succeeds
3. We crash before we can write success
Now we'll send duplicate emails. I don't think all APIs have ways to avoid duplicate emails/transactions, so that could be a hairy problem.
- skybrian 5y agoUnless you use an API that supports duplicate request removal, either you drop some emails (at-most-once delivery) or sometimes you send duplicates (at-least-once delivery). For email, I think the occasional duplicate is usually better. (Effectively, it's up to the email recipient to ignore the duplicate.)