Skip to content

Commit

Permalink
[misc] avoid double-negative variable use
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Apr 16, 2024
1 parent 78dfc92 commit 3e589c7
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,7 @@ class Connection extends EventEmitter {
const resetCmd = new Reset(
cmdParam,
() => {
if (conn.prepareCache)
conn.prepareCache.reset();
if (conn.prepareCache) conn.prepareCache.reset();
let prom = Promise.resolve();
// re-execute init query / session query timeout
prom
Expand Down Expand Up @@ -1081,34 +1080,33 @@ class Connection extends EventEmitter {
* Add command to command sending and receiving queue.
*
* @param cmd command
* @param expectResponse queue command response
* @private
*/
addCommandEnable(cmd, skipReceive) {
addCommandEnable(cmd, expectResponse) {
cmd.once('end', this._sendNextCmdImmediate.bind(this));

//send immediately only if no current active receiver
if (this.sendQueue.isEmpty() && this.receiveQueue.isEmpty()) {
if (!skipReceive)
this.receiveQueue.push(cmd);
if (expectResponse) this.receiveQueue.push(cmd);
cmd.start(this.streamOut, this.opts, this.info);
} else {
if (!skipReceive)
this.receiveQueue.push(cmd);
if (expectResponse) this.receiveQueue.push(cmd);
this.sendQueue.push(cmd);
}
}

/**
* Add command to command sending and receiving queue using pipelining
*
* @param cmd command
* @param cmd command
* @param expectResponse queue command response
* @private
*/
addCommandEnablePipeline(cmd, skipReceive) {
addCommandEnablePipeline(cmd, expectResponse) {
cmd.once('send_end', this._sendNextCmdImmediate.bind(this));

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

Expand Down

0 comments on commit 3e589c7

Please sign in to comment.