From 9011f0a0dfaf2b7e433d17eee2ed84a9823c9179 Mon Sep 17 00:00:00 2001 From: fomaper <38674512+fomaper@users.noreply.github.com> Date: Sun, 11 Oct 2026 07:59:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(client):=20apply=20=E4=B8=8E=20status=20?= =?UTF-8?q?=E8=90=BD=E8=BF=9B=2020s=20=E9=BB=98=E8=AE=A4=E8=B6=85=E6=97=B6?= =?UTF-8?q?=E8=A2=AB=20abort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apiTimeoutMs() 只给 /dsh-purge/update(POST 180s / GET 45s)、 /dsh-purge/uninstall(90s)、/dsh-purge/skill 三类例外,其余一律落到 return 20000。apply 与 status 都在这个默认值里。 补丁条目较多时应用一遍必然超过 20 秒(每条都要读文件、比对 marker、写回), 后端又是同步落盘,期间 status 也会被阻塞。前端 AbortController 到点 abort, isAbortError() 把它转成 new Error("timeout"),界面渲染成「读取失败: timeout」。 后端其实还在正常跑完,只是前端不再等待。 补上四个超时:status 60s、apply 240s、revert 120s、restart 60s。 --- client.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.js b/client.js index edf963f..949d3c4 100644 --- a/client.js +++ b/client.js @@ -46,6 +46,11 @@ window.__ModuleLoader__.load({ id: "dsh-purge", factory: (require) => { if (path.indexOf("/dsh-purge/update") !== -1) return method === "POST" ? 180000 : 45000; if (path.indexOf("/dsh-purge/uninstall") !== -1) return 90000; if (path.indexOf("/dsh-purge/skill") !== -1) return method === "POST" ? 120000 : 20000; + // status 会在"应用"期间被后端的同步落盘阻塞,默认 20s 必然被 abort,界面只会显示"读取失败: timeout"。 + if (path.indexOf("/dsh-purge/status") !== -1) return 60000; + if (path.indexOf("/dsh-purge/apply") !== -1) return 240000; + if (path.indexOf("/dsh-purge/revert") !== -1) return 120000; + if (path.indexOf("/dsh-purge/restart") !== -1) return 60000; return 20000; } function isAbortError(e) {