Skip to content

fix(sync): upsertIssueRecord is an atomic INSERT ON CONFLICT — closes the race - #671

Open
yggdrasilworld wants to merge 1 commit into
MergeFi:mainfrom
yggdrasilworld:fix/upsert-race-562
Open

yggdrasilworld wants to merge 1 commit into
MergeFi:mainfrom
yggdrasilworld:fix/upsert-race-562

Conversation

@yggdrasilworld

Copy link
Copy Markdown

What

findIssueByGithubIdOrNull → save(create) let two concurrent syncs both find no row and both INSERT → one hit the unique githubIssueId constraint (regression of #376).

Fix

Atomic INSERT ... ON CONFLICT DO UPDATE — the write's race-safe; the stale-check above still guards the update path.

Resolves #562

… the race

The read-then-save let two concurrent syncs both find no row and both
INSERT, so one hit the unique githubIssueId constraint. The atomic
INSERT ... ON CONFLICT DO UPDATE makes the write race-safe; the stale-check
above still guards the update path.

Resolves MergeFi#562
@vercel

vercel Bot commented Oct 14, 2026

Copy link
Copy Markdown

@yggdrasilworld is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Regression on closed #376] upsertIssueRecord's read-then-insert still races between a webhook and a sync for a new issue

1 participant