Merge pull request #8 from CartoDB/copyto-detach-connection-after-done
Do not detach streams before finishing
This commit is contained in:
commit
be101502d9
@ -3,6 +3,9 @@
|
|||||||
## v2.2.0-carto.1
|
## v2.2.0-carto.1
|
||||||
Released 2018-mm-dd
|
Released 2018-mm-dd
|
||||||
|
|
||||||
|
Bug fixes:
|
||||||
|
* Copy to: ensure stream is detached when finished
|
||||||
|
|
||||||
## v1.2.0-carto.3
|
## v1.2.0-carto.3
|
||||||
Released 2018-11-21
|
Released 2018-11-21
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ CopyStreamQuery.prototype.submit = function(connection) {
|
|||||||
connection.query(this.text)
|
connection.query(this.text)
|
||||||
this.connection = connection
|
this.connection = connection
|
||||||
this.connection.removeAllListeners('copyData')
|
this.connection.removeAllListeners('copyData')
|
||||||
|
this.on('end', () => this._detach())
|
||||||
connection.stream.pipe(this)
|
connection.stream.pipe(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,7 +85,6 @@ CopyStreamQuery.prototype._transform = function(chunk, enc, cb) {
|
|||||||
case code.ErrorResponse:
|
case code.ErrorResponse:
|
||||||
case code.CopyDone:
|
case code.CopyDone:
|
||||||
pushBufferIfneeded();
|
pushBufferIfneeded();
|
||||||
this._detach()
|
|
||||||
this.push(null)
|
this.push(null)
|
||||||
return cb();
|
return cb();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user