From 661f092fb2ec33791cd58ca16612f8cf0a39ecd1 Mon Sep 17 00:00:00 2001 From: Hibryda Date: Thu, 12 Mar 2026 05:51:51 +0100 Subject: [PATCH] fix: use tauri::async_runtime::spawn for WAL checkpoint task tokio::spawn() panics during Tauri setup in WebDriver E2E mode because the Tokio runtime is not directly accessible. Switch to tauri::async_runtime::spawn() which uses Tauri's managed runtime. --- v2/src-tauri/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/v2/src-tauri/src/lib.rs b/v2/src-tauri/src/lib.rs index 619e634..057ecd3 100644 --- a/v2/src-tauri/src/lib.rs +++ b/v2/src-tauri/src/lib.rs @@ -123,8 +123,10 @@ pub(crate) fn checkpoint_wal(path: &Path) -> Result<(), String> { } /// Spawn a background task that checkpoints WAL on both databases every 5 minutes. +/// Uses `tauri::async_runtime::spawn` instead of `tokio::spawn` because this runs +/// during Tauri setup where the Tokio runtime may not be directly accessible. fn spawn_wal_checkpoint_task(sessions_db_path: PathBuf, btmsg_db_path: PathBuf) { - tokio::spawn(async move { + tauri::async_runtime::spawn(async move { let interval = std::time::Duration::from_secs(300); loop { tokio::time::sleep(interval).await;