copy to: remove unneeded done and removing it as a dependency

This commit is contained in:
Simon Martín 2018-06-21 13:13:16 +02:00
parent 7e593bb3c9
commit 1dac5355d1
2 changed files with 5 additions and 6 deletions

View File

@ -71,7 +71,7 @@ function handleCopyTo (logger) {
res.header("Content-Type", "application/octet-stream");
streamCopy.to(
function (err, pgstream, copyToStream, done) {
function (err, pgstream, copyToStream) {
if (err) {
return next(err);
}
@ -80,7 +80,7 @@ function handleCopyTo (logger) {
.on('data', data => metrics.addSize(data.length))
.on('error', (err) => {
metrics.end(null, err);
pgstream.unpipe(res);
pgstream.unpipe();
return next(err);
})
@ -91,14 +91,13 @@ function handleCopyTo (logger) {
pgstream.emit('cancelQuery', err);
metrics.end(null, err);
pgstream.unpipe(res);
pgstream.unpipe();
return next(err);
})
.on('error', err => {
metrics.end(null, err);
pgstream.unpipe(res);
done();
pgstream.unpipe();
return next(err);
});

View File

@ -31,7 +31,7 @@ module.exports = class StreamCopy {
done(err);
});
cb(null, pgstream, copyToStream, done);
cb(null, pgstream, copyToStream);
});
}