feat: move to async runtime

This commit is contained in:
DecDuck
2025-07-26 17:37:11 +10:00
parent 682c6e9c0b
commit f92ec38231
30 changed files with 1639 additions and 1197 deletions
+9 -4
View File
@@ -4,14 +4,19 @@ use tauri::AppHandle;
use crate::AppState;
#[tauri::command]
pub fn quit(app: tauri::AppHandle, state: tauri::State<'_, std::sync::Mutex<AppState<'_>>>) {
cleanup_and_exit(&app, &state);
pub async fn quit(app: tauri::AppHandle, state: tauri::State<'_, std::sync::Mutex<AppState<'_>>>) -> Result<(), ()> {
cleanup_and_exit(&app, &state).await;
Ok(())
}
pub fn cleanup_and_exit(app: &AppHandle, state: &tauri::State<'_, std::sync::Mutex<AppState<'_>>>) {
pub async fn cleanup_and_exit(
app: &AppHandle,
state: &tauri::State<'_, std::sync::Mutex<AppState<'_>>>,
) {
debug!("cleaning up and exiting application");
let download_manager = state.lock().unwrap().download_manager.clone();
match download_manager.ensure_terminated() {
match download_manager.ensure_terminated().await {
Ok(res) => match res {
Ok(_) => debug!("download manager terminated correctly"),
Err(_) => error!("download manager failed to terminate correctly"),