-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat: support explicit resource management in QueryRunner #11701
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
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
c6ccf7d to
dcb6e1c
Compare
dcb6e1c to
efa732d
Compare
|
Thanks for this lovely feature @alumni |
|
@gioboa What do you think about the transactions that are in progress in that Right now, we only call Not all drivers support a transaction (e.g. MongoDB, some of the SQLite drivers), but for those that do, we could have a transaction in progress. So I was wondering, should we commit the transaction? Should we roll it back if not explicitly committed? Also, some databases have save points ("nested transactions", e.g. Postgres) - how should those be handled? Should they all be committed? I'm thinking to add: async [Symbol.asyncDispose](): Promise<void> {
try {
while (this.isTransactionActive) {
await this.commitTransaction();
}
} finally {
await this.release()
}
} |
|
That's a hard decision, but I think your suggestion is a good one. We can probably have a voting session with the maintainer team to agree with this. |
|
Okay, I think I figured out that we don't need to release all savepoints, we can simply commit once. Should work in most drivers based on my understanding. Pushing a commit now. |
78c5e63 to
ee1b60d
Compare
Description of change
This PR adds support for Explicit Resource Management in
QueryRunner. See more:usingDeclarations and Explicit Resource ManagementThe
QueryRunnerwill be released automatically at the end of its scope:Pull-Request Checklist
nextbranchFixes #00000