mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
fix: streamline service availability checks and improve logging for core startup
This commit is contained in:
@@ -1070,22 +1070,24 @@ impl CoreManager {
|
|||||||
service::reinstall_service().await?;
|
service::reinstall_service().await?;
|
||||||
}
|
}
|
||||||
logging!(info, Type::Core, true, "服务可用,使用服务模式启动");
|
logging!(info, Type::Core, true, "服务可用,使用服务模式启动");
|
||||||
|
self.stop_core_by_service().await?;
|
||||||
self.start_core_by_service().await?;
|
self.start_core_by_service().await?;
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
|
|
||||||
|
// 服务不可用,检查用户偏好
|
||||||
|
let service_state = service::ServiceState::get().await;
|
||||||
|
if service_state.prefer_sidecar {
|
||||||
|
logging!(
|
||||||
|
info,
|
||||||
|
Type::Core,
|
||||||
|
true,
|
||||||
|
"服务不可用,根据用户偏好使用Sidecar模式"
|
||||||
|
);
|
||||||
|
self.start_core_by_sidecar().await?;
|
||||||
} else {
|
} else {
|
||||||
// 服务不可用,检查用户偏好
|
logging!(info, Type::Core, true, "服务不可用,使用Sidecar模式");
|
||||||
let service_state = service::ServiceState::get().await;
|
self.start_core_by_sidecar().await?;
|
||||||
if service_state.prefer_sidecar {
|
|
||||||
logging!(
|
|
||||||
info,
|
|
||||||
Type::Core,
|
|
||||||
true,
|
|
||||||
"服务不可用,根据用户偏好使用Sidecar模式"
|
|
||||||
);
|
|
||||||
self.start_core_by_sidecar().await?;
|
|
||||||
} else {
|
|
||||||
logging!(info, Type::Core, true, "服务不可用,使用Sidecar模式");
|
|
||||||
self.start_core_by_sidecar().await?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -1102,7 +1104,6 @@ impl CoreManager {
|
|||||||
/// 重启内核
|
/// 重启内核
|
||||||
pub async fn restart_core(&self) -> Result<()> {
|
pub async fn restart_core(&self) -> Result<()> {
|
||||||
self.stop_core().await?;
|
self.stop_core().await?;
|
||||||
|
|
||||||
self.start_core().await?;
|
self.start_core().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user