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.
This commit is contained in:
2026-03-18 10:06:18 +01:00
parent 0fcea99006
commit 9f32c273e0

View File

@@ -264,7 +264,7 @@ fn clear_session(app: AppHandle, state: State<'_, AppState>) -> Result<(), Strin
} }
#[tauri::command] #[tauri::command]
async fn sync_profile(app: AppHandle, state: State<'_, AppState>) -> Result<EnrollmentResult, String> { async fn sync_profile(app: AppHandle, _state: State<'_, AppState>) -> Result<EnrollmentResult, String> {
let session_state = sync_current_session(&app).await?; let session_state = sync_current_session(&app).await?;
refresh_tray_menu(&app); refresh_tray_menu(&app);
Ok(session_state.enrollment) Ok(session_state.enrollment)
@@ -666,11 +666,9 @@ pub fn run() {
refresh_tray_menu(app.handle()); refresh_tray_menu(app.handle());
let app_handle = app.handle().clone(); let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move { std::thread::spawn(move || loop {
loop { refresh_tray_menu(&app_handle);
refresh_tray_menu(&app_handle); std::thread::sleep(std::time::Duration::from_secs(5));
tauri::async_runtime::sleep(std::time::Duration::from_secs(5)).await;
}
}); });
Ok(()) Ok(())