From 7003f6070fd8a4997ec7fe52ca32a8bfd155838a Mon Sep 17 00:00:00 2001 From: jeromew Date: Fri, 29 Jul 2016 23:50:09 +0000 Subject: [PATCH] Fix issue #54: `end` is being triggered 2 times --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index d6f0399..17b7237 100644 --- a/index.js +++ b/index.js @@ -62,8 +62,9 @@ CopyStreamQuery.prototype.handleCommandComplete = function(msg) { this.rowCount = parseInt(match[1], 10) } - this.unpipe() - this.emit('end') + // unpipe from connection + this.unpipe(this.connection) + this.connection = null } CopyStreamQuery.prototype.handleReadyForQuery = function() {