fix: apply config timeout (#6384)

* fix: apply config timeout

* docs: update Changelog.md

* Update src-tauri/src/core/manager/config.rs

---------

Co-authored-by: Tunglies <tunglies.dev@outlook.com>
This commit is contained in:
oomeow 2026-02-27 22:55:11 +08:00 committed by GitHub
parent 19e4df528b
commit 25a83388bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 28 additions and 22 deletions

1
.gitignore vendored
View File

@ -14,3 +14,4 @@ scripts/_env.sh
.changelog_backups
target
CLAUDE.md
.vfox.toml

29
Cargo.lock generated
View File

@ -1306,7 +1306,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]
@ -3398,12 +3398,12 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
"socket2 0.6.2",
"socket2 0.5.10",
"system-configuration",
"tokio",
"tower-service",
"tracing",
"windows-registry 0.6.1",
"windows-registry",
]
[[package]]
@ -4834,7 +4834,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
@ -5605,7 +5605,7 @@ dependencies = [
"quinn-udp",
"rustc-hash",
"rustls",
"socket2 0.6.2",
"socket2 0.5.10",
"thiserror 2.0.18",
"tokio",
"tracing",
@ -5643,7 +5643,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
"socket2 0.6.2",
"socket2 0.5.10",
"tracing",
"windows-sys 0.60.2",
]
@ -7461,7 +7461,7 @@ dependencies = [
"thiserror 2.0.18",
"tracing",
"url",
"windows-registry 0.5.3",
"windows-registry",
"windows-result 0.3.4",
]
@ -7574,7 +7574,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-mihomo"
version = "0.1.7"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#96025cd790e8738de2d2c268a1ba84d6271d7834"
source = "git+https://github.com/clash-verge-rev/tauri-plugin-mihomo#5979c6169b3def4782f4cabe9099703943279108"
dependencies = [
"futures-util",
"http 1.4.0",
@ -9256,7 +9256,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.61.2",
"windows-sys 0.48.0",
]
[[package]]
@ -9436,17 +9436,6 @@ dependencies = [
"windows-strings 0.4.2",
]
[[package]]
name = "windows-registry"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
dependencies = [
"windows-link 0.2.1",
"windows-result 0.4.1",
"windows-strings 0.5.1",
]
[[package]]
name = "windows-result"
version = "0.3.4"

View File

@ -5,6 +5,7 @@
- 修复 Windows 管理员身份运行时开关 TUN 模式异常
- 修复静默启动与自动轻量模式存在冲突
- 修复进入轻量模式后无法返回主界面
- 切换配置文件偶尔失败的问题
<details>
<summary><strong> ✨ 新增功能 </strong></summary>

View File

@ -89,8 +89,23 @@ impl CoreManager {
Ok(())
}
Err(err) => {
Config::runtime().await.discard();
Err(anyhow!("Failed to apply config: {}", err))
logging!(
warn,
Type::Core,
"Failed to apply configuration by mihomo api, restart core to apply it, error msg: {err}"
);
match self.restart_core().await {
Ok(_) => {
Config::runtime().await.apply();
logging!(info, Type::Core, "Configuration applied after restart");
Ok(())
}
Err(err) => {
logging!(error, Type::Core, "Failed to restart core: {}", err);
Config::runtime().await.discard();
Err(anyhow!("Failed to apply config: {}", err))
}
}
}
}
}