Fix app hanging on sidecar startup
All checks were successful
All checks were successful
Two issues caused the app to freeze on "Starting sidecar...": 1. wait_for_ready() used a blocking BufReader::lines() iterator with a timeout check between lines. If the sidecar produced no stdout output (crashed, missing binary, or slow model loading), the read blocked forever. Now uses a background thread with mpsc::recv_timeout() for a real 120s deadline. 2. start_sidecar was a synchronous Tauri command that blocked the main thread during the entire sidecar startup (up to 120s). Now async via tokio::spawn_blocking, keeping the UI responsive. Also logs all sidecar stdout lines to stderr with [sidecar-stdout] prefix for debugging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,9 +29,9 @@ pub fn run() {
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_process::init())
|
||||
.manage(sidecar::ManagedSidecar(Mutex::new(
|
||||
.manage(sidecar::ManagedSidecar(std::sync::Arc::new(Mutex::new(
|
||||
sidecar::SidecarManager::new(),
|
||||
)))
|
||||
))))
|
||||
.setup(|app| {
|
||||
let resource_dir = app
|
||||
.path()
|
||||
|
||||
Reference in New Issue
Block a user