From 16478d314b10f274ebd89839720e1d250e284671 Mon Sep 17 00:00:00 2001 From: oomeow Date: Tue, 18 Nov 2025 09:52:48 +0800 Subject: [PATCH] fix: install service (#5479) * fix: compatible older service version when install service * docs: update Changelog.md * chore: check service available * chore: wait for service server is running * fix: update changelog to reflect compatibility with legacy service mode upgrades --------- Co-authored-by: Tunglies Co-authored-by: Tunglies <77394545+Tunglies@users.noreply.github.com> --- Changelog.md | 1 + src-tauri/src/core/service.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Changelog.md b/Changelog.md index d01e4a0c2..283fc612f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -7,6 +7,7 @@ - macOS 非预期 Tproxy 端口设置 - 流量图缩放异常 - PAC 自动代理脚本内容无法动态调整 +- 兼容从旧版服务模式升级 - Monaco 编辑器的行数上限
diff --git a/src-tauri/src/core/service.rs b/src-tauri/src/core/service.rs index 5c378e6f1..15426919a 100644 --- a/src-tauri/src/core/service.rs +++ b/src-tauri/src/core/service.rs @@ -555,6 +555,13 @@ impl ServiceManager { ServiceStatus::InstallRequired => { logging!(info, Type::Service, "需要安装服务,执行安装流程"); install_service().await?; + // compatible with older service version, force reinstall if service is unavailable + // wait for service server is running + tokio::time::sleep(Duration::from_millis(500)).await; + if is_service_available().await.is_err() { + logging!(info, Type::Service, "服务需要强制重装,执行强制重装流程"); + force_reinstall_service().await?; + } self.0 = ServiceStatus::Ready; } ServiceStatus::UninstallRequired => {