refactor: improve code formatting and enhance logging in resolve_setup_async function

This commit is contained in:
xmk23333
2025-10-20 13:27:01 +08:00
parent 786c981fe0
commit 278ab30d40
2 changed files with 9 additions and 3 deletions

View File

@@ -31,8 +31,8 @@ use std::time::Instant;
use std::{error::Error, fmt, path::PathBuf, sync::Arc, time::Duration}; use std::{error::Error, fmt, path::PathBuf, sync::Arc, time::Duration};
use tauri_plugin_mihomo::Error as MihomoError; use tauri_plugin_mihomo::Error as MihomoError;
use tauri_plugin_shell::ShellExt; use tauri_plugin_shell::ShellExt;
use tokio::time::sleep;
use tokio::sync::Semaphore; use tokio::sync::Semaphore;
use tokio::time::sleep;
// TODO: // TODO:
// - 重构,提升模式切换速度 // - 重构,提升模式切换速度
@@ -136,7 +136,8 @@ impl CoreManager {
Err(e) Err(e)
} }
} }
}.await; }
.await;
drop(permit); drop(permit);
result result

View File

@@ -86,7 +86,12 @@ pub fn resolve_setup_async() {
}); });
let elapsed = start_time.elapsed(); let elapsed = start_time.elapsed();
logging!(info, Type::Setup, "异步设置任务启动完成,耗时: {:?}", elapsed); logging!(
info,
Type::Setup,
"异步设置任务启动完成,耗时: {:?}",
elapsed
);
if elapsed.as_secs() > 10 { if elapsed.as_secs() > 10 {
logging!(warn, Type::Setup, "异步设置任务耗时较长({:?})", elapsed); logging!(warn, Type::Setup, "异步设置任务耗时较长({:?})", elapsed);