From d98e36108356fd41ac6d792ae948086415c7a350 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 26 Aug 2021 23:59:17 +0200 Subject: [PATCH] quick debounce --- copyparty/web/up2k.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index a906fe5e..aa441e15 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -898,7 +898,7 @@ function up2k_init(subtle) { } ebi('u2cleanup').onclick = u2cleanup; - var etaref = 0; + var etaref = 0, etaskip = 0; function etafun() { var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length, nsend = st.busy.upload.length + st.todo.upload.length, @@ -951,6 +951,9 @@ function up2k_init(subtle) { continue; } + if (etaskip) + continue; + if (eta < 60 * 60 * 24) try { eta = /.*(..:..:..).*/.exec(new Date(eta * 1000).toUTCString())[1]; @@ -960,6 +963,8 @@ function up2k_init(subtle) { ebi(t[a][0]).innerHTML = '{0}, {1}/s, {2}'.format( humansize(rem), humansize(bps, 1), eta); } + if (++etaskip > 2) + etaskip = 0; } /////