fix(daemon): enforce session idle timeout

This commit is contained in:
NianJiuZst
2026-07-10 22:36:13 +08:00
parent 913a3f80a4
commit 13279a7f56
7 changed files with 211 additions and 16 deletions
+7 -1
View File
@@ -44,10 +44,16 @@ pub async fn run(
Some(path) => Some(ipc::IpcServer::new(Arc::clone(&state)).bind(path).await?),
None => None,
};
let session_idle_task = start::spawn_session_idle_reaper(Arc::clone(&state));
// Ensure WS/IPC accept loops have polled `shutdown.notified()` before any
// caller can invoke `DaemonHandle::shutdown()` — `Notify::notify_waiters()`
// drops wakeups when nothing is registered yet, which otherwise hangs
// shutdown forever (hit by tests that connect/shutdown immediately).
tokio::task::yield_now().await;
Ok(DaemonHandle::new(state, ws_handle, ipc_handle))
Ok(DaemonHandle::new(
state,
ws_handle,
ipc_handle,
session_idle_task,
))
}