up2k-cli: less aggressive retries

This commit is contained in:
ed 2021-09-25 18:18:15 +02:00
parent 86d4c43909
commit 189391fccd

View file

@ -1370,7 +1370,7 @@ function up2k_init(subtle) {
pvis.move(t.n, 'ng'); pvis.move(t.n, 'ng');
apop(st.busy.hash, t); apop(st.busy.hash, t);
st.bytes.finished += t.size; st.bytes.finished += t.size;
return tasker(); return;
} }
toast.err(0, 'y o u b r o k e i t\nfile: ' + esc(t.name + '') + '\nerror: ' + err); toast.err(0, 'y o u b r o k e i t\nfile: ' + esc(t.name + '') + '\nerror: ' + err);
@ -1446,7 +1446,6 @@ function up2k_init(subtle) {
console.log('head onerror, retrying', t); console.log('head onerror, retrying', t);
apop(st.busy.head, t); apop(st.busy.head, t);
st.todo.head.unshift(t); st.todo.head.unshift(t);
tasker();
}; };
function orz(e) { function orz(e) {
var ok = false; var ok = false;
@ -1511,7 +1510,6 @@ function up2k_init(subtle) {
apop(st.busy.handshake, t); apop(st.busy.handshake, t);
st.todo.handshake.unshift(t); st.todo.handshake.unshift(t);
t.keepalive = keepalive; t.keepalive = keepalive;
tasker();
}; };
function orz(e) { function orz(e) {
if (t.t_busied != me) { if (t.t_busied != me) {
@ -1705,7 +1703,8 @@ function up2k_init(subtle) {
st.busy.upload.push(upt); st.busy.upload.push(upt);
var npart = upt.npart, var npart = upt.npart,
t = st.files[upt.nfile]; t = st.files[upt.nfile],
tries = 0;
if (!t.t_uploading) if (!t.t_uploading)
t.t_uploading = Date.now(); t.t_uploading = Date.now();
@ -1756,8 +1755,9 @@ function up2k_init(subtle) {
if (crashed) if (crashed)
return; return;
console.log('chunkpit onerror, retrying', t); toast.err(9, "failed to upload a chunk,\n" + tries + " retries so far -- retrying in 10sec\n\n" + t.name);
do_send(); console.log('chunkpit onerror,', ++tries, t);
setTimeout(do_send, 10 * 1000);
}; };
xhr.open('POST', t.purl, true); xhr.open('POST', t.purl, true);
xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart]); xhr.setRequestHeader("X-Up2k-Hash", t.hash[npart]);