fix: change error handling in patch_profiles_config to return false when a switch is in progress
fix: ensure CURRENT_SWITCHING_PROFILE is reset after config updates in perform_config_update and patch_profiles_config
This commit is contained in:
@@ -388,7 +388,7 @@ pub async fn patch_profiles_config(profiles: IProfiles) -> CmdResult<bool> {
|
||||
.is_err()
|
||||
{
|
||||
logging!(info, Type::Cmd, "当前正在切换配置,放弃请求");
|
||||
return Err("Profile switching is already in progress".into());
|
||||
return Ok(false);
|
||||
}
|
||||
|
||||
let target_profile = profiles.current.as_ref();
|
||||
@@ -410,7 +410,7 @@ pub async fn patch_profiles_config(profiles: IProfiles) -> CmdResult<bool> {
|
||||
&& validate_new_profile(switch_to_profile).await.is_err()
|
||||
{
|
||||
CURRENT_SWITCHING_PROFILE.store(false, Ordering::Release);
|
||||
return Err("Target profile validation failed".into());
|
||||
return Ok(false);
|
||||
}
|
||||
let _ = Config::profiles()
|
||||
.await
|
||||
|
||||
@@ -714,7 +714,5 @@
|
||||
"Unlock menu order": "Unlock menu order",
|
||||
"Lock menu order": "Lock menu order",
|
||||
"Open App Log": "Open App Log",
|
||||
"Open Core Log": "Open Core Log",
|
||||
"Profile switching is already in progress": "Profile switching is already in progress",
|
||||
"Target profile validation failed": "Target profile validation failed"
|
||||
"Open Core Log": "Open Core Log"
|
||||
}
|
||||
|
||||
@@ -715,7 +715,5 @@
|
||||
"Lock menu order": "锁定菜单排序",
|
||||
"Open App Log": "应用日志",
|
||||
"Open Core Log": "内核日志",
|
||||
"TPROXY Port": "TPROXY 透明代理端口",
|
||||
"Profile switching is already in progress": "配置文件切换已在进行中",
|
||||
"Target profile validation failed": "目标配置文件验证失败"
|
||||
"TPROXY Port": "TPROXY 透明代理端口"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user