Skip to content

Commit

Permalink
[misc] fix closing of prepared statements
Browse files Browse the repository at this point in the history
  • Loading branch information
mscdex authored and rusher committed Apr 16, 2024
1 parent 2442249 commit 78dfc92
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,15 +1083,17 @@ class Connection extends EventEmitter {
* @param cmd command
* @private
*/
addCommandEnable(cmd) {
addCommandEnable(cmd, skipReceive) {
cmd.once('end', this._sendNextCmdImmediate.bind(this));

//send immediately only if no current active receiver
if (this.sendQueue.isEmpty() && this.receiveQueue.isEmpty()) {
this.receiveQueue.push(cmd);
if (!skipReceive)
this.receiveQueue.push(cmd);
cmd.start(this.streamOut, this.opts, this.info);
} else {
this.receiveQueue.push(cmd);
if (!skipReceive)
this.receiveQueue.push(cmd);
this.sendQueue.push(cmd);
}
}
Expand All @@ -1102,10 +1104,11 @@ class Connection extends EventEmitter {
* @param cmd command
* @private
*/
addCommandEnablePipeline(cmd) {
addCommandEnablePipeline(cmd, skipReceive) {
cmd.once('send_end', this._sendNextCmdImmediate.bind(this));

this.receiveQueue.push(cmd);
if (!skipReceive)
this.receiveQueue.push(cmd);
if (this.sendQueue.isEmpty()) {
cmd.start(this.streamOut, this.opts, this.info);
if (cmd.sending) {
Expand Down Expand Up @@ -1786,7 +1789,8 @@ class Connection extends EventEmitter {
() => {},
() => {},
prepareResultPacket
)
),
true
);
}

Expand Down

0 comments on commit 78dfc92

Please sign in to comment.