mirror of
https://github.com/Drop-OSS/drop-app.git
synced 2026-07-24 17:03:14 +10:00
feat: move to async runtime
This commit is contained in:
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user