quick debounce

This commit is contained in:
ed 2021-08-26 23:59:17 +02:00
parent ce7f5309c7
commit d98e361083

View file

@ -898,7 +898,7 @@ function up2k_init(subtle) {
} }
ebi('u2cleanup').onclick = u2cleanup; ebi('u2cleanup').onclick = u2cleanup;
var etaref = 0; var etaref = 0, etaskip = 0;
function etafun() { function etafun() {
var nhash = st.busy.head.length + st.busy.hash.length + st.todo.head.length + st.todo.hash.length, 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, nsend = st.busy.upload.length + st.todo.upload.length,
@ -951,6 +951,9 @@ function up2k_init(subtle) {
continue; continue;
} }
if (etaskip)
continue;
if (eta < 60 * 60 * 24) if (eta < 60 * 60 * 24)
try { try {
eta = /.*(..:..:..).*/.exec(new Date(eta * 1000).toUTCString())[1]; 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( ebi(t[a][0]).innerHTML = '{0}, {1}/s, {2}'.format(
humansize(rem), humansize(bps, 1), eta); humansize(rem), humansize(bps, 1), eta);
} }
if (++etaskip > 2)
etaskip = 0;
} }
///// /////