Do not emit to regist the number of rows processed in copyto
This commit is contained in:
parent
eb4ba60ba0
commit
5655f26fbd
@ -74,12 +74,8 @@ function handleCopyTo (logger) {
|
||||
res.header("Content-Disposition", `attachment; filename=${encodeURIComponent(filename)}`);
|
||||
res.header("Content-Type", "application/octet-stream");
|
||||
|
||||
streamCopy.on('copy-to-end', rows => {
|
||||
metrics.end(rows);
|
||||
});
|
||||
|
||||
streamCopy.to(
|
||||
function (err, pgstream, client, done) {
|
||||
function (err, pgstream, copyToStream, client, done) {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
@ -120,6 +116,8 @@ function handleCopyTo (logger) {
|
||||
return next(err);
|
||||
});
|
||||
|
||||
pgstream.on('end', () => metrics.end(copyToStream.rowCount));
|
||||
|
||||
pgstream
|
||||
.on('data', data => metrics.addSize(data.length))
|
||||
.pipe(res);
|
||||
|
@ -29,10 +29,9 @@ module.exports = class StreamCopy extends EventEmitter {
|
||||
})
|
||||
.on('end', () => {
|
||||
done();
|
||||
this.emit('copy-to-end', copyToStream.rowCount);
|
||||
});
|
||||
|
||||
cb(null, pgstream, client, done);
|
||||
cb(null, pgstream, copyToStream, client, done);
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user