Skip to content

Conversation

KMKoushik
Copy link
Member

Summary

  • avoid incrementing dashboard metrics if event already processed

Testing

  • pnpm lint (fails: ESLint couldn't find an eslint.config file)

https://chatgpt.com/codex/tasks/task_e_6840f3c1a0bc8329afc341eb7a6713db

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Email Event Handling Fails Race Condition

The logic for handling duplicate email events is flawed. An early check for an existing event is intended to prevent double-counting metrics, but a race condition exists due to the delay before record creation, potentially allowing concurrent calls to double-count metrics (e.g., campaign analytics). A new email event record is also unconditionally created, resulting in duplicate records. The early check is also inefficient, running unnecessarily for DELIVERY_DELAYED events that trigger an early return.

apps/web/src/server/service/ses-hook-parser.ts#L43-L168

https://github.com/unsend-dev/unsend/blob/cd3d7937cc676676de853bcd5f62265309d50360/apps/web/src/server/service/ses-hook-parser.ts#L43-L168

Fix in Cursor


BugBot free trial expires on June 9, 2025
You have used $0.00 of your $50.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@KMKoushik
Copy link
Member Author

BugBot run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant