Skip to content

Rollback database transactions when inserts or updates fail#2956

Merged
howardchung merged 2 commits intoodota:masterfrom
ff137:fix/rollback-on-db-error
May 9, 2026
Merged

Rollback database transactions when inserts or updates fail#2956
howardchung merged 2 commits intoodota:masterfrom
ff137:fix/rollback-on-db-error

Conversation

@ff137
Copy link
Copy Markdown
Contributor

@ff137 ff137 commented May 9, 2026

What
If match inserts (insertMatch), rating updates (rater), or Stripe subscriber sync (syncSubs) throw after starting a transaction, we now roll back that transaction before the error propagates.

Why
Without an explicit rollback, a failed path can leave Postgres sessions stuck in a bad transaction state and tie up pool connections.

ff137 and others added 2 commits May 9, 2026 18:48
If work after db.transaction() throws, release the client with rollback
before rethrowing so the pool is not left with an open transaction.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mirror insertMatch behavior so exceptions after db.transaction() always
call trx.rollback() before propagating.

Co-authored-by: Cursor <cursoragent@cursor.com>
@howardchung howardchung merged commit 4ae01a7 into odota:master May 9, 2026
1 check passed
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.

2 participants