From 72560850d7ca0c07591acfc8421e26469d283423 Mon Sep 17 00:00:00 2001 From: "Brian M. Carlson" Date: Tue, 13 Jun 2017 17:02:23 -0500 Subject: [PATCH] Working on disconnect issue --- lib/client.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/client.js b/lib/client.js index 3104f70b..5800e943 100644 --- a/lib/client.js +++ b/lib/client.js @@ -409,17 +409,15 @@ Client.prototype.query = function(config, values, callback) { Client.prototype.end = function(cb) { this._ending = true; - if (this.activeQuery) { - return this.connection.stream.end() - } - this.connection.end(); if (cb) { this.connection.once('end', cb); - } else { - return new global.Promise((resolve) => { - this.connection.once('end', resolve); - }); + this.connection.end(); + return; } + return new global.Promise((resolve) => { + this.connection.end(); + this.connection.once('end', resolve); + }); }; Client.md5 = function(string) {