refactor service manager locking

This commit is contained in:
Tunglies
2026-05-28 23:22:56 +08:00
parent 08fd2ce68b
commit 6e6c537e6b
4 changed files with 109 additions and 100 deletions
+2 -7
View File
@@ -175,14 +175,9 @@ pub(super) async fn init_verge_config() {
pub(super) async fn init_service_manager() {
clash_verge_service_ipc::set_config(Some(ServiceManager::config())).await;
if !is_service_ipc_path_exists() {
return;
if is_service_ipc_path_exists() && SERVICE_MANAGER.init().await.is_ok() {
logging_error!(Type::Setup, SERVICE_MANAGER.refresh().await);
}
let mut manager = SERVICE_MANAGER.lock().await;
if manager.init().await.is_ok() {
logging_error!(Type::Setup, manager.refresh().await);
}
drop(manager);
}
pub(super) async fn init_core_manager() {