better up2k stitching on fat32 servers:

* the batches don't need to be window-aligned
* improve js backoff (in case of more funnies)
This commit is contained in:
ed 2024-08-05 19:52:50 +00:00
parent 3d245431fc
commit 373194c38a
2 changed files with 7 additions and 3 deletions

View file

@ -3041,6 +3041,7 @@ class Up2k(object):
chunksize = up2k_chunksize(job["size"])
coffsets = []
nchunks = []
for chash in chashes:
nchunk = [n for n, v in enumerate(job["hash"]) if v == chash]
if not nchunk:
@ -3048,6 +3049,7 @@ class Up2k(object):
ofs = [chunksize * x for x in nchunk]
coffsets.append(ofs)
nchunks.append(nchunk)
for ofs1, ofs2 in zip(coffsets, coffsets[1:]):
gap = (ofs2[0] - ofs1[0]) - chunksize
@ -3059,9 +3061,9 @@ class Up2k(object):
if not job["sprs"]:
cur_sz = bos.path.getsize(path)
if ofs[0] > cur_sz:
if coffsets[0][0] > cur_sz:
t = "please upload sequentially using one thread;\nserver filesystem does not support sparse files.\n file: {}\n chunk: {}\n cofs: {}\n flen: {}"
t = t.format(job["name"], nchunk[0], ofs[0], cur_sz)
t = t.format(job["name"], nchunks[0][0], coffsets[0][0], cur_sz)
raise Pebkac(400, t)
job["busy"][chash] = 1

View file

@ -2400,6 +2400,7 @@ function up2k_init(subtle) {
'nparts': nparts
});
}
t.nojoin = 0;
msg = null;
done = false;
@ -2606,7 +2607,7 @@ function up2k_init(subtle) {
}
else if (txt.indexOf('already got that') + 1 ||
txt.indexOf('already being written') + 1) {
t.nojoin = t.postlist.length;
t.nojoin = t.nojoin || t.postlist.length;
console.log("ignoring dupe-segment with backoff", t.nojoin, t.name, t);
if (!toast.visible && st.todo.upload.length < 4)
toast.msg(10, L.u_cbusy);
@ -2657,6 +2658,7 @@ function up2k_init(subtle) {
if (!toast.visible)
toast.warn(9.98, L.u_cuerr.format(snpart, Math.ceil(t.size / chunksize), t.name), t);
t.nojoin = t.nojoin || t.postlist.length; // maybe rproxy postsize limit
console.log('chunkpit onerror,', ++tries, t.name, t);
orz2(xhr);
};