diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 88e1ffecf..c3b374ca0 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -36,7 +36,7 @@ mod app_init { /// Initialize singleton monitoring for other instances pub fn init_singleton_check() -> Result<()> { - tauri::async_runtime::block_on(async move { + AsyncHandler::block_on(async move { logging!(info, Type::Setup, "开始检查单例实例..."); server::check_singleton().await?; Ok(()) @@ -425,7 +425,7 @@ pub fn run() { }); } tauri::RunEvent::ExitRequested { api, code, .. } => { - tauri::async_runtime::block_on(async { + AsyncHandler::block_on(async { let _ = handle::Handle::mihomo() .await .clear_all_ws_connections() diff --git a/src-tauri/src/process/async_handler.rs b/src-tauri/src/process/async_handler.rs index eeb60cf57..8c7966207 100644 --- a/src-tauri/src/process/async_handler.rs +++ b/src-tauri/src/process/async_handler.rs @@ -12,6 +12,7 @@ impl AsyncHandler { // async_runtime::handle() // } + #[inline] #[track_caller] pub fn spawn(f: F) -> JoinHandle<()> where @@ -23,6 +24,7 @@ impl AsyncHandler { async_runtime::spawn(f()) } + #[inline] #[track_caller] pub fn spawn_blocking(f: F) -> JoinHandle where @@ -34,7 +36,7 @@ impl AsyncHandler { async_runtime::spawn_blocking(f) } - #[allow(dead_code)] + #[inline] #[track_caller] pub fn block_on(fut: Fut) -> Fut::Output where