Deduping SES delivery events with a read before every write
My micro SaaS is an email API for AI agents. It records delivery events from SES, and a repeated event would be stored twice if you insert each one as it arrives.
The fix was small. Before inserting, I look for an existing event on the same email with the same type and the same recipients, and skip it if there is one. It costs a read before every write.
A unique constraint would be cleaner, but the recipients live in a JSON column. Would you move them out into their own table for that?
Deduping SES delivery events with a read before every write
My micro SaaS is an email API for AI agents. It records delivery events from SES, and a repeated event would be stored twice if you insert each one as it arrives.
The fix was small. Before inserting, I look for an existing event on the same email with the same type and the same recipients, and skip it if there is one. It costs a read before every write.
A unique constraint would be cleaner, but the recipients live in a JSON column. Would you move them out into their own table for that?