fix(appd): signal all supervisors to abort on clean shutdown

SessionRegistry::shutdown_all() clears abort_senders, dropping all
oneshot senders. Each supervised process's abort_rx fires, causing
supervise() to kill the child. A 200ms yield after shutdown_all gives
the tokio runtime time to schedule the abort handling before the
process exits and the socket file is removed.
This commit is contained in:
Marco Allegretti 2026-03-11 11:28:29 +01:00
parent e1c15ea463
commit 0bcb6b1bf6

View file

@ -93,6 +93,10 @@ impl SessionRegistry {
pub(crate) fn broadcast(&self) -> &tokio::sync::broadcast::Sender<Response> { pub(crate) fn broadcast(&self) -> &tokio::sync::broadcast::Sender<Response> {
&self.broadcast &self.broadcast
} }
pub(crate) fn shutdown_all(&mut self) {
self.abort_senders.clear();
}
} }
#[tokio::main] #[tokio::main]
@ -175,6 +179,8 @@ async fn run() -> anyhow::Result<()> {
} }
} }
registry.lock().await.shutdown_all();
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
let _ = std::fs::remove_file(&socket_path); let _ = std::fs::remove_file(&socket_path);
Ok(()) Ok(())
} }