You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
resend-sync marks a user synced before adding them, so an interrupted run loses that user permanently #553
resend-sync marks a user as synced before adding them to Resend. If the process dies between those two steps, that user is never added to the audience and never gets a welcome email, because every later run skips them as already synced.
L442 skips any email already in synced_emails, which is loaded from resend_synced_users.
L455mark_user_synced(...) commits the claim row (ON CONFLICT DO NOTHING on uq_resend_synced_email_audience).
L468add_contact_to_resend(...). If it raises, L476 removes the claim, so the user is retried next run.
L486send_welcome_email(...). Failures are logged and ignored.
The rollback in step 3 only covers an exception. If the process is killed after step 2 and before step 3 finishes (OOM, eviction, deploy, node loss, or SIGKILL after the termination grace period), the claim row stays, and the user is skipped in step 1 on every future run. A kill between steps 3 and 4 leaves the user in the audience with no welcome email, and nothing retries it.
The job sleeps for rate limiting between users (L483, L495), so a run can take a long time, which makes a kill mid-run more likely.
Impact
One user per interrupted run. That user never joins the audience, or never gets the welcome email, and nothing surfaces it.
Off by default. The job is disabled in the chart by default, so this affects only deployments that enable it.
Proposed fix
Record progress per user rather than claiming up front:
Add a status to resend_synced_users: pending, then added, then welcomed.
Skip only users that reached added, or welcomed for the email step.
Treat pending rows older than a threshold as retryable.
add_contact_to_resend should be safe to repeat for an email already in the audience; confirm that against the Resend API. A simpler alternative is to write the claim only after add_contact_to_resend succeeds, accepting a possible duplicate add if a concurrent run races, since the unique constraint still limits the claim to one row.
[Automatic Post]: This issue has had no activity for 42 days (labels: bug). Could someone take a look when they have a chance and help figure out next steps?
Generated by OpenHands automation on behalf of the user.
Activity
all-hands-bot commentedon Nov 10, 2026
[Automatic Post]: This issue has had no activity for 42 days (labels: bug). Could someone take a look when they have a chance and help figure out next steps?
Generated by OpenHands automation on behalf of the user.