mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
passes stream-tester-timestamp
- moves 'end' event listener to constructor, only listen once - ensures all existing tests still green
This commit is contained in:
parent
87b52f9e51
commit
cab956ba50
4
index.js
4
index.js
@ -11,6 +11,9 @@ var QueryStream = module.exports = function(text, values, options) {
|
||||
})
|
||||
this.batchSize = options.batchSize || 100
|
||||
this._ready = false
|
||||
this.once('end', function() {
|
||||
setImmediate(function() { this.emit('close') }.bind(this));
|
||||
})
|
||||
//kick reader
|
||||
this.read()
|
||||
}
|
||||
@ -35,7 +38,6 @@ QueryStream.prototype._read = function(n) {
|
||||
if(!rows.length) {
|
||||
setImmediate(function() {
|
||||
self.push(null)
|
||||
self.once('end', self.emit.bind(self, 'close'))
|
||||
})
|
||||
}
|
||||
self._reading = false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user