-
-
Notifications
You must be signed in to change notification settings - Fork 665
feat: implement COM_RESET_CONNECTION with pool integration #4148
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
dbec5f0
feat: implement COM_RESET_CONNECTION command
sidorares 929830b
feat: add resetOnRelease pool option for automatic connection state c…
sidorares e93c260
fix: resolve TypeScript and linting errors in tests
sidorares 7ac4d77
fix: disable resetOnRelease for timing-sensitive existing tests
sidorares 2b3793c
fix: resolve remaining TypeScript type assertion errors
sidorares 31b516c
fix: remove 'any' type and fix formatting in pool reset test
sidorares 3f0f476
fix: make reset() resolve with void to match Promise<void> typing
sidorares 6572f05
fix: address Copilot and wellwelwel review feedback
sidorares 80c85be
fix: add missing resetOnRelease parameter to test helper getConfig()
sidorares e944918
fix: add TypeScript type cast for resetOnRelease in getConfig()
sidorares 6632ff7
Merge branch 'master' into feature/reset-connection
wellwelwel 1868b56
Merge branch 'master' into feature/reset-connection
wellwelwel 13fd4e5
Merge branch 'master' into feature/reset-connection
wellwelwel bd2a22a
Merge branch 'master' into feature/reset-connection
wellwelwel d353b5f
Merge branch 'master' into feature/reset-connection
wellwelwel 62e0594
fix: make resetOnRelease default to false to avoid breaking change
sidorares 660be19
fix: address review feedback in reset connection tests
sidorares e63aa51
Merge branch 'master' into feature/reset-connection
sidorares dc8da19
docs: add reset connection and resetOnRelease documentation
sidorares File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| 'use strict'; | ||
|
|
||
| const Command = require('./command'); | ||
| const Packets = require('../packets/index.js'); | ||
|
|
||
| class ResetConnection extends Command { | ||
| constructor(callback) { | ||
| super(); | ||
| this.onResult = callback; | ||
| } | ||
|
|
||
| start(packet, connection) { | ||
| const req = new Packets.ResetConnection(); | ||
| connection.writePacket(req.toPacket()); | ||
| return ResetConnection.prototype.resetConnectionResponse; | ||
| } | ||
|
|
||
| resetConnectionResponse(packet, connection) { | ||
| if (connection._statements) { | ||
| connection._statements.clear(); | ||
| } | ||
| if (this.onResult) { | ||
| process.nextTick(this.onResult.bind(this, null)); | ||
| } | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| module.exports = ResetConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| 'use strict'; | ||
|
|
||
| const Packet = require('../packets/packet'); | ||
| const CommandCodes = require('../constants/commands'); | ||
|
|
||
| class ResetConnection { | ||
| constructor() {} | ||
|
|
||
| toPacket() { | ||
| const packet = new Packet(0, Buffer.alloc(5), 0, 5); | ||
| packet.offset = 4; | ||
| packet.writeInt8(CommandCodes.RESET_CONNECTION); | ||
| return packet; | ||
| } | ||
| } | ||
|
|
||
| module.exports = ResetConnection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.