Skip to content

Commit 7256085

Browse files
committed
Working on disconnect issue
1 parent 3a7b226 commit 7256085

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/client.js

+6-8
Original file line numberDiff line numberDiff line change
@@ -409,17 +409,15 @@ Client.prototype.query = function(config, values, callback) {
409409

410410
Client.prototype.end = function(cb) {
411411
this._ending = true;
412-
if (this.activeQuery) {
413-
return this.connection.stream.end()
414-
}
415-
this.connection.end();
416412
if (cb) {
417413
this.connection.once('end', cb);
418-
} else {
419-
return new global.Promise((resolve) => {
420-
this.connection.once('end', resolve);
421-
});
414+
this.connection.end();
415+
return;
422416
}
417+
return new global.Promise((resolve) => {
418+
this.connection.end();
419+
this.connection.once('end', resolve);
420+
});
423421
};
424422

425423
Client.md5 = function(string) {

0 commit comments

Comments
 (0)