From 78dfc92c88feea2bfd569283b72ef6b097553ea8 Mon Sep 17 00:00:00 2001 From: Brian White Date: Fri, 5 Apr 2024 20:54:36 -0400 Subject: [PATCH] [misc] fix closing of prepared statements --- lib/connection.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/connection.js b/lib/connection.js index 2be510b6..b0a68b30 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -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); } } @@ -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) { @@ -1786,7 +1789,8 @@ class Connection extends EventEmitter { () => {}, () => {}, prepareResultPacket - ) + ), + true ); }