Do not resume internal connection stream (handled properly in the pg-copy-stream module)

This commit is contained in:
Daniel García Aubert 2019-05-24 17:31:56 +02:00
parent e57f7b6ecf
commit 19b9aab042

View File

@ -46,17 +46,14 @@ module.exports = class StreamCopy {
this.clientProcessID = client.processID;
const streamMaker = action === ACTION_TO ? copyTo : copyFrom;
this.stream = streamMaker(this.sql);
this.stream = action === ACTION_TO ? copyTo(this.sql) : copyFrom(this.sql);
const pgstream = client.query(this.stream);
if (action === ACTION_TO) {
pgstream.on('end', () => {
pgstream.connection.stream.resume();
done();
});
pgstream.on('end', () => done());
} else if (action === ACTION_FROM) {
pgstream.on('finish', () => done())
pgstream.on('finish', () => done());
}
pgstream.on('error', err => done(err));