upload: ETA updated every 5 seconds
Massimo Melina committed
Sep 17, 2023 at 11:27 UTC
a18a8fcf36aefebe9ef2ea027787ad34d8f2bbc3
1 file changed
+2
-4
frontend/src/upload.ts
+2
-4
@@ -57,14 +57,12 @@ setInterval(() => {
57
uploadState.speed = bytesSent / passed
58
bytesSent = 0 // reset counter
59
bytesSentTimestamp = now
60
-}, 1_000)
60
62
-// keep track of ETA
63
-setInterval(() => {
61
+ // keep track of ETA
62
const qBytes = _.sumBy(uploadState.qs, q => _.sumBy(q.files, f => f.size))
63
const left = (qBytes - uploadState.partial)
64
uploadState.eta = uploadState.speed && Math.round(left / uploadState.speed)
67
-}, 1000)
65
+}, 5_000)
66
67
let reloadOnClose = false
68
let uploadDialogIsOpen = false