Do not emit error as it closes the internal DB's connection stream and the Pool needs to keep it open to reuse the the connection

remotes/origin/node-12
Daniel García Aubert 4 years ago
parent 95a092bd83
commit 57be7add68

@ -123,7 +123,7 @@ function handleCopyFrom (logger) {
metrics.end(null, err);
pgstream.emit('error', err);
})
.on('close', () => pgstream.emit('error', new Error('Connection closed by client')))
.on('close', () => pgstream.emit('client-close', new Error('Connection closed by client')))
.pipe(throttle)
.pipe(decompress)
.on('data', data => {

@ -56,7 +56,7 @@ module.exports = class StreamCopy {
pgstream.on('warning', (msg) => this.logger.warn(msg));
} else if (action === ACTION_FROM) {
pgstream.on('finish', () => done());
pgstream.on('error', err => client.connection.sendCopyFail(err.message));
pgstream.on('client-close', err => client.connection.sendCopyFail(err.message));
}
pgstream.on('error', err => done(err));

Loading…
Cancel
Save