Compare commits

...

1 Commits

Author SHA1 Message Date
Julien Fontanet
a174f8fcfc feat(backup/VmBackup): regularly report speed in task info 2022-01-24 15:42:51 +01:00

View File

@@ -251,6 +251,20 @@ exports.VmBackup = class VmBackup {
const timestamp = Date.now()
const progress = {
handle: setInterval(() => {
const { size } = sizeContainer
const timestamp = Date.now()
Task.info('transfer', {
speed: (size - progress.size) / (timestamp - progress.timestamp),
})
progress.size = size
progress.timestamp = timestamp
}, 5e3 * 60),
size: sizeContainer.size,
timestamp,
}
await this._callWriters(
writer =>
writer.run({
@@ -261,6 +275,8 @@ exports.VmBackup = class VmBackup {
'writer.run()'
)
clearInterval(progress.handle)
const { size } = sizeContainer
const end = Date.now()
const duration = end - timestamp