-
Notifications
You must be signed in to change notification settings - Fork 15
Feat: transaction #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…andler and add usage examples
…patterns, development guidelines, project context, and README
…ractices for using connection pools and isolation levels
…o use 'docker compose' syntax
…clude retry attempts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| resolve(connection); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Promise pool getConnection causes application to hang indefinitely
The comment on line 290 claims this code "works for both callback and promise pools" but it only works with callback-style pools. When using a promise pool from mysql2/promise, the getConnection method returns a Promise and ignores the callback argument. This causes the outer new Promise to never resolve, hanging the application indefinitely. The example file examples/transaction_example.js demonstrates this exact broken pattern by importing from mysql2/promise and creating a pool, which would cause beginTransaction to hang when called.
Additional Locations (1)
| } | ||
|
|
||
| await transaction.begin(); | ||
| return transaction; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Connection leak when transaction.begin() fails
If transaction.begin() throws an error on line 342, the pool connection obtained earlier (lines 291-304) is never released back to the pool. The connection release logic is only in the overridden commit() and rollback() methods, which are never called when begin() fails. This causes connection pool exhaustion over time as failed begin attempts leak connections.
Note
Adds pool-aware transaction API (beginTransaction/commit/rollback) with updated typings and docs, plus Docker-based MySQL feature tests and expanded CI node matrix.
QueryHandler.beginTransaction(options)that acquires/reuses connections (pool-aware) and auto-releases oncommit/rollback.QueryHandler.commit()andQueryHandler.rollback()helpers.index.d.tswithbeginTransaction,commit,rollback, andTransactionLeveltypings.examples/transaction_example.jsshowcasing recommended patterns.docker-compose.yml) and feature test setup:tests/init-feature-tables.sql,tests/setup-feature-db.js,tests/transaction.ft.js.feature-test.ymlto run containerized MySQL feature tests..github/workflows/ci.ymlto Node22,24and keep macOS/Ubuntu.feature-test,setup-feature-db,feature-test:local.Written by Cursor Bugbot for commit 4d59577. This will update automatically on new commits. Configure here.