From dbaee8a5e453897b83c82508d33c784c03863498 Mon Sep 17 00:00:00 2001 From: Tunglies <77394545+Tunglies@users.noreply.github.com> Date: Tue, 27 Oct 2026 17:58:27 +0800 Subject: [PATCH] refactor(profile): remove identical blind retry when switching node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second select_node_for_group call in switch_proxy_node was a zero-interval retry with identical arguments. Its success path was a degraded copy of the first (missing the Refresh::Proxies announcement ever since the old force-refresh emit was removed), and its distinct "回退/最终失败" log wording misled maintainers. Keep a single call, the primary success aftermath, and one error log. --- src-tauri/src/feat/profile.rs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src-tauri/src/feat/profile.rs b/src-tauri/src/feat/profile.rs index 56faeb01d..a74e7dd39 100644 --- a/src-tauri/src/feat/profile.rs +++ b/src-tauri/src/feat/profile.rs @@ -47,26 +47,11 @@ pub async fn switch_proxy_node(group_name: &str, proxy_name: &str) { record_switched_node(group_name, proxy_name).await; announce(Refresh::Proxies); let _ = tray::Tray::global().update_menu().await; - return; } Err(err) => { logging!(error, Type::Tray, "切换代理失败: {err:?}"); } } - - match handle::Handle::mihomo() - .select_node_for_group(group_name, proxy_name) - .await - { - Ok(_) => { - logging!(info, Type::Tray, "代理切换回退成功: {} -> {}", group_name, proxy_name); - record_switched_node(group_name, proxy_name).await; - let _ = tray::Tray::global().update_menu().await; - } - Err(err) => { - logging!(error, Type::Tray, "代理切换最终失败: {err:?}"); - } - } } async fn should_update_profile(uid: &String, ignore_auto_update: bool) -> Result)>> {