refactor: fix formating in rust
This commit is contained in:
@@ -31,7 +31,13 @@ pub async fn update_profile(
|
||||
option: Option<PrfOption>,
|
||||
auto_refresh: Option<bool>,
|
||||
) -> Result<()> {
|
||||
logging!(info, Type::Config, true, "[Subscription Update] Start updating subscription {}", uid);
|
||||
logging!(
|
||||
info,
|
||||
Type::Config,
|
||||
true,
|
||||
"[Subscription Update] Start updating subscription {}",
|
||||
uid
|
||||
);
|
||||
let auto_refresh = auto_refresh.unwrap_or(true); // 默认为true,保持兼容性
|
||||
|
||||
let url_opt = {
|
||||
@@ -131,14 +137,30 @@ pub async fn update_profile(
|
||||
};
|
||||
|
||||
if should_update {
|
||||
logging!(info, Type::Config, true, "[Subscription Update] Update core configuration");
|
||||
logging!(
|
||||
info,
|
||||
Type::Config,
|
||||
true,
|
||||
"[Subscription Update] Update core configuration"
|
||||
);
|
||||
match CoreManager::global().update_config().await {
|
||||
Ok(_) => {
|
||||
logging!(info, Type::Config, true, "[Subscription Update] Update succeeded");
|
||||
logging!(
|
||||
info,
|
||||
Type::Config,
|
||||
true,
|
||||
"[Subscription Update] Update succeeded"
|
||||
);
|
||||
handle::Handle::refresh_clash();
|
||||
}
|
||||
Err(err) => {
|
||||
logging!(error, Type::Config, true, "[Subscription Update] Update failed: {}", err);
|
||||
logging!(
|
||||
error,
|
||||
Type::Config,
|
||||
true,
|
||||
"[Subscription Update] Update failed: {}",
|
||||
err
|
||||
);
|
||||
handle::Handle::notice_message("update_failed", format!("{err}"));
|
||||
log::error!(target: "app", "{err}");
|
||||
}
|
||||
|
||||
@@ -78,7 +78,12 @@ pub fn quit() {
|
||||
|
||||
// 使用异步任务处理资源清理,避免阻塞
|
||||
AsyncHandler::spawn(move || async move {
|
||||
logging!(info, Type::System, true, "Start asynchronous resource cleanup");
|
||||
logging!(
|
||||
info,
|
||||
Type::System,
|
||||
true,
|
||||
"Start asynchronous resource cleanup"
|
||||
);
|
||||
let cleanup_result = clean_async().await;
|
||||
|
||||
logging!(
|
||||
@@ -95,7 +100,12 @@ pub fn quit() {
|
||||
async fn clean_async() -> bool {
|
||||
use tokio::time::{timeout, Duration};
|
||||
|
||||
logging!(info, Type::System, true, "Start executing asynchronous cleanup...");
|
||||
logging!(
|
||||
info,
|
||||
Type::System,
|
||||
true,
|
||||
"Start executing asynchronous cleanup..."
|
||||
);
|
||||
|
||||
// 1. 处理TUN模式
|
||||
let tun_task = async {
|
||||
@@ -220,7 +230,13 @@ pub fn clean() -> bool {
|
||||
|
||||
match rx.recv_timeout(std::time::Duration::from_secs(8)) {
|
||||
Ok(result) => {
|
||||
logging!(info, Type::System, true, "Cleanup completed, result: {}", result);
|
||||
logging!(
|
||||
info,
|
||||
Type::System,
|
||||
true,
|
||||
"Cleanup completed, result: {}",
|
||||
result
|
||||
);
|
||||
result
|
||||
}
|
||||
Err(_) => {
|
||||
|
||||
Reference in New Issue
Block a user