log metrics only once

This commit is contained in:
Simon Martín 2018-06-05 12:36:36 +02:00
parent 550c736032
commit dd689d3568

View File

@ -16,6 +16,8 @@ module.exports = class StreamCopyMetrics {
this.time = null;
this.error = null;
this.ended = false;
}
addSize(size) {
@ -23,6 +25,12 @@ module.exports = class StreamCopyMetrics {
}
end(rows = null, error = null) {
if (this.ended) {
return;
}
this.ended = true;
if (Number.isInteger(rows)) {
this.rows = rows;
}