fix: fix mysql2 invalid configuration option poolWaitTimeout#8
fix: fix mysql2 invalid configuration option poolWaitTimeout#8killagu merged 1 commit intonode-modules:masterfrom
Conversation
WalkthroughThe changes involve the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RDSClient
User->>RDSClient: Initialize with options
RDSClient->>RDSClient: Destructure options
RDSClient->>RDSClient: Set #poolWaitTimeout
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range, codebase verification and nitpick comments (1)
src/client.ts (1)
Line range hint
70-86: Constructor changes are well-implemented with a minor suggestion.The addition of
poolWaitTimeoutto the destructured options is correctly implemented, and the default value handling is appropriate. This change should effectively resolve the configuration issue withmysql2.Suggestion:
Consider adding a comment explaining the default value forpoolWaitTimeoutto improve code readability and maintainability.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/client.ts (2 hunks)
Additional comments not posted (3)
src/client.ts (3)
Line range hint
98-118: Query method handles connections effectively.The method correctly manages database connections and transaction contexts, ensuring that connections are released appropriately. This is crucial for preventing connection leaks and maintaining database performance.
Line range hint
149-165: Robust implementation of connection timeout handling.The
getConnectionWithTimeoutmethod effectively usesPromise.raceto handle connection timeouts, ensuring that the system can gracefully handle situations where the database is unresponsive. This addition enhances the robustness of the connection management.
Line range hint
183-262: Transaction management methods are well-structured and robust.The
beginTransactionScopeandbeginDoomedTransactionScopemethods effectively manage transaction scopes, handling nesting and rollback scenarios appropriately. These methods are crucial for ensuring data consistency and handling errors gracefully.
[skip ci] ## [1.2.1](v1.2.0...v1.2.1) (2024-09-06) ### Bug Fixes * fix mysql2 invalid configuration option poolWaitTimeout ([#8](#8)) ([7293c2e](7293c2e))
[skip ci] ## 1.0.0 (2024-01-30) ### ⚠ BREAKING CHANGES * In `Promise.all` case, Parallel beginTransactionScope will create isolated transactions. * drop Node.js < 16 support ### Features * add *beginTransactionScope(scope) ([0013a63](node-modules/rds@0013a63)) * add count(table, where) ([6286c46](node-modules/rds@6286c46)) * add get(), list(), insert(), update() ([9cae1cb](node-modules/rds@9cae1cb)) * add options.needFields, default is true ([18e0dea](node-modules/rds@18e0dea)) * add queryOne api ([#9](node-modules/rds#9)) ([19fc1bb](node-modules/rds@19fc1bb)) * add Transaction ([cfdcf26](node-modules/rds@cfdcf26)) * add unlock/lock tables ([#97](https://github.com/node-modules/myrds/issues/97)) ([4dc3452](node-modules/rds@4dc3452)) * add unlock/lock tables ([#97](https://github.com/node-modules/myrds/issues/97)) ([0a61be6](node-modules/rds@0a61be6)) * dynamic retrieval of database connection configuration ([#110](https://github.com/node-modules/myrds/issues/110)) ([f437efb](node-modules/rds@f437efb)) * export connection and query diagnostics_channel ([#111](https://github.com/node-modules/myrds/issues/111)) ([64aa75d](node-modules/rds@64aa75d)) * export sqlstring method ([#79](https://github.com/node-modules/myrds/issues/79)) ([2e99ab8](node-modules/rds@2e99ab8)) * impl with typescript ([#103](https://github.com/node-modules/myrds/issues/103)) ([1cf7814](node-modules/rds@1cf7814)) * promiseify ([#20](https://github.com/node-modules/myrds/issues/20)) ([e4aed30](node-modules/rds@e4aed30)) * stats 增加使用中的连接数 ([#115](https://github.com/node-modules/myrds/issues/115)) ([2b152a1](node-modules/rds@2b152a1)) * support custom query lifecricle ([#104](https://github.com/node-modules/myrds/issues/104)) ([5941c69](node-modules/rds@5941c69)) * support doomed transaction scope on test cases ([#58](https://github.com/node-modules/myrds/issues/58)) ([b227bc1](node-modules/rds@b227bc1)) * support end() ([b3eab93](node-modules/rds@b3eab93)) * support insert multi rows ([abb4804](node-modules/rds@abb4804)) * support mysql2 ([#1](node-modules/rds#1)) ([eb9f391](node-modules/rds@eb9f391)) * support query(sql, object) ([#12](node-modules/rds#12)) ([a55e82f](node-modules/rds@a55e82f)) * support transaction on one request ctx ([#7](node-modules/rds#7)) ([3bd4e44](node-modules/rds@3bd4e44)) * update multiple rows ([#55](https://github.com/node-modules/myrds/issues/55)) ([859d818](node-modules/rds@859d818)) * use AsyncLocalStorage to refactor transaction, to make it more safe ([#108](https://github.com/node-modules/myrds/issues/108)) ([ae327fa](node-modules/rds@ae327fa)) * where condition support NULL value ([#60](https://github.com/node-modules/myrds/issues/60)) ([0d4d4ab](node-modules/rds@0d4d4ab)) * wrap generator function to promise ([#19](https://github.com/node-modules/myrds/issues/19)) ([fe1b4a3](node-modules/rds@fe1b4a3)) ### Bug Fixes * `where` with empty object ([#15](node-modules/rds#15)) ([db0b90e](node-modules/rds@db0b90e)) * add default value now() of `gmt_modified` and `gmt_create` ([#56](https://github.com/node-modules/myrds/issues/56)) ([db6d596](node-modules/rds@db6d596)) * don't export protected methods ([#106](https://github.com/node-modules/myrds/issues/106)) ([b2757df](node-modules/rds@b2757df)) * don't redefined sqlstring.escape ([#39](https://github.com/node-modules/myrds/issues/39)) ([5ca4489](node-modules/rds@5ca4489)) * export pool getter from rds client ([#102](https://github.com/node-modules/myrds/issues/102)) ([4048807](node-modules/rds@4048807)) * handle concurrent transaction ([#85](https://github.com/node-modules/myrds/issues/85)) ([d983478](node-modules/rds@d983478)) * move sql to error stack ([#8](node-modules/rds#8)) ([54349cd](node-modules/rds@54349cd)) * mysql type not found ([#109](https://github.com/node-modules/myrds/issues/109)) ([6a9bc45](node-modules/rds@6a9bc45)) * query parameters are not allowed to be included in where ([#67](https://github.com/node-modules/myrds/issues/67)) ([52147de](node-modules/rds@52147de)) * should export conn property ([#101](https://github.com/node-modules/myrds/issues/101)) ([37afa42](node-modules/rds@37afa42)) * support multi lifecricle hooks ([#105](https://github.com/node-modules/myrds/issues/105)) ([53b0a70](node-modules/rds@53b0a70)) * use master branch ([758877d](node-modules/rds@758877d))
Unpicked
optionswill becomemysqlOptionsand pass to mysql2, mean while mysql2 will console.error a message, causing egg fail to start.Summary by CodeRabbit
poolWaitTimeoutoption for improved connection management.