Skip to content

Commit c5988a0

Browse files
committed
up2k.js: bump handshake timeout for safededup
1 parent a2e0f98 commit c5988a0

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,8 @@ below are some tweaks roughly ordered by usefulness:
19551955
* `-q` disables logging and can help a bunch, even when combined with `-lo` to redirect logs to file
19561956
* `--hist` pointing to a fast location (ssd) will make directory listings and searches faster when `-e2d` or `-e2t` is set
19571957
* and also makes thumbnails load faster, regardless of e2d/e2t
1958+
* `--dedup` enables deduplication and thus avoids writing to the HDD if someone uploads a dupe
1959+
* `--safe-dedup 1` makes deduplication much faster during upload by skipping verification of file contents; safe if there is no other software editing/moving the files in the volumes
19581960
* `--no-hash .` when indexing a network-disk if you don't care about the actual filehashes and only want the names/tags searchable
19591961
* if your volumes are on a network-disk such as NFS / SMB / s3, specifying larger values for `--iobuf` and/or `--s-rd-sz` and/or `--s-wr-sz` may help; try setting all of them to `524288` or `1048576` or `4194304`
19601962
* `--no-htp --hash-mt=0 --mtag-mt=1 --th-mt=1` minimizes the number of threads; can help in some eccentric environments (like the vscode debugger)

copyparty/cfg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def vf_bmap() -> dict[str, str]:
2020
"no_thumb": "dthumb",
2121
"no_vthumb": "dvthumb",
2222
"no_athumb": "dathumb",
23-
"safe_dedup": "safededup",
2423
}
2524
for k in (
2625
"dedup",
@@ -59,6 +58,7 @@ def vf_vmap() -> dict[str, str]:
5958
"no_hash": "nohash",
6059
"no_idx": "noidx",
6160
"re_maxage": "scan",
61+
"safe_dedup": "safededup",
6262
"th_convt": "convt",
6363
"th_size": "thsize",
6464
"th_crop": "crop",

copyparty/up2k.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2681,7 +2681,7 @@ def _handle_json(self, cj: dict[str, Any], depth: int = 1) -> dict[str, Any]:
26812681
jcur = self.cur.get(ptop)
26822682
reg = self.registry[ptop]
26832683
vfs = self.asrv.vfs.all_vols[cj["vtop"]]
2684-
n4g = vfs.flags.get("noforget")
2684+
n4g = bool(vfs.flags.get("noforget"))
26852685
rand = vfs.flags.get("rand") or cj.get("rand")
26862686
lost: list[tuple["sqlite3.Cursor", str, str]] = []
26872687

copyparty/web/browser.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ var Ls = {
518518
"u_etaprep": '(preparing to upload)',
519519
"u_hashdone": 'hashing done',
520520
"u_hashing": 'hash',
521+
"u_hs": 'handshaking...',
521522
"u_dupdefer": "duplicate; will be processed after all other files",
522523
"u_actx": "click this text to prevent loss of<br />performance when switching to other windows/tabs",
523524
"u_fixed": "OK!&nbsp; Fixed it 👍",
@@ -1081,6 +1082,7 @@ var Ls = {
10811082
"u_etaprep": '(forbereder opplastning)',
10821083
"u_hashdone": 'befaring ferdig',
10831084
"u_hashing": 'les',
1085+
"u_hs": 'serveren tenker...',
10841086
"u_dupdefer": "duplikat; vil bli håndtert til slutt",
10851087
"u_actx": "klikk her for å forhindre tap av<br />ytelse ved bytte til andre vinduer/faner",
10861088
"u_fixed": "OK!&nbsp; Løste seg 👍",
@@ -1644,6 +1646,7 @@ var Ls = {
16441646
"u_etaprep": '(准备上传)',
16451647
"u_hashdone": '哈希完成',
16461648
"u_hashing": '哈希',
1649+
"u_hs": '正在等待服务器...', //m
16471650
"u_dupdefer": "这是一个重复文件。它将在所有其他文件上传后进行处理", //m
16481651
"u_actx": "单击此文本以防止切换到其他窗口/选项卡时性能下降", //m
16491652
"u_fixed": "好!&nbsp;已修复 👍",

copyparty/web/up2k.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,14 +1745,6 @@ function up2k_init(subtle) {
17451745

17461746
var mou_ikkai = false;
17471747

1748-
if (st.busy.handshake.length &&
1749-
st.busy.handshake[0].t_busied < now - 30 * 1000
1750-
) {
1751-
console.log("retrying stuck handshake");
1752-
var t = st.busy.handshake.shift();
1753-
st.todo.handshake.unshift(t);
1754-
}
1755-
17561748
var nprev = -1;
17571749
for (var a = 0; a < st.todo.upload.length; a++) {
17581750
var nf = st.todo.upload[a].nfile;
@@ -2254,6 +2246,9 @@ function up2k_init(subtle) {
22542246
if (keepalive)
22552247
console.log("sending keepalive handshake", t.name, t);
22562248

2249+
if (!t.srch && !t.t_handshake)
2250+
pvis.seth(t.n, 2, L.u_hs);
2251+
22572252
var xhr = new XMLHttpRequest();
22582253
xhr.onerror = xhr.ontimeout = function () {
22592254
if (t.t_busied != me) // t.done ok
@@ -2533,7 +2528,8 @@ function up2k_init(subtle) {
25332528

25342529
xhr.open('POST', t.purl, true);
25352530
xhr.responseType = 'text';
2536-
xhr.timeout = 42000;
2531+
xhr.timeout = 42000 + (t.srch || t.t_uploaded ? 0 :
2532+
(t.size / (1048 * 20))); // safededup 20M/s hdd
25372533
xhr.send(JSON.stringify(req));
25382534
}
25392535

0 commit comments

Comments
 (0)