From e1117155ae41fcb393714fc0c9e638181c0049b5 Mon Sep 17 00:00:00 2001 From: Stephen Sugden Date: Wed, 25 Dec 2013 13:33:34 -0800 Subject: [PATCH] Emit 'close' events when query completes Consider a system where one component is scheduling tasks that yield streams, and passing them to (unknown) clients for consumption. It would be useful for the scheduler to know that the query underlying the stream is completed (so it can continue on to it's next task) without having to wait for the consumer to finish reading all results. --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index b29eab0c..fcc61d67 100644 --- a/index.js +++ b/index.js @@ -98,6 +98,7 @@ QueryStream.prototype.handleCommandComplete = function(msg) { } QueryStream.prototype.handleReadyForQuery = function() { + this.emit('close') this.push(null) }