From 9f32c273e00a322893d508845aa610d76bc998cb Mon Sep 17 00:00:00 2001 From: nessi Date: Wed, 18 Mar 2026 10:06:18 +0100 Subject: [PATCH] refactor: replace async runtime with blocking thread for tray menu refresh and mark unused state parameter Replace tauri::async_runtime::spawn with std::thread::spawn for periodic tray menu refresh background task and change async sleep to blocking thread sleep. Prefix unused state parameter with underscore in sync_profile command to suppress compiler warnings. --- desktop-client/src-tauri/src/lib.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/desktop-client/src-tauri/src/lib.rs b/desktop-client/src-tauri/src/lib.rs index 026cda6..ed19605 100644 --- a/desktop-client/src-tauri/src/lib.rs +++ b/desktop-client/src-tauri/src/lib.rs @@ -264,7 +264,7 @@ fn clear_session(app: AppHandle, state: State<'_, AppState>) -> Result<(), Strin } #[tauri::command] -async fn sync_profile(app: AppHandle, state: State<'_, AppState>) -> Result { +async fn sync_profile(app: AppHandle, _state: State<'_, AppState>) -> Result { let session_state = sync_current_session(&app).await?; refresh_tray_menu(&app); Ok(session_state.enrollment) @@ -666,11 +666,9 @@ pub fn run() { refresh_tray_menu(app.handle()); let app_handle = app.handle().clone(); - tauri::async_runtime::spawn(async move { - loop { - refresh_tray_menu(&app_handle); - tauri::async_runtime::sleep(std::time::Duration::from_secs(5)).await; - } + std::thread::spawn(move || loop { + refresh_tray_menu(&app_handle); + std::thread::sleep(std::time::Duration::from_secs(5)); }); Ok(())