mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-03-27 01:13:09 +00:00
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:
parent
e1c15ea463
commit
0bcb6b1bf6
1 changed files with 6 additions and 0 deletions
|
|
@ -93,6 +93,10 @@ impl SessionRegistry {
|
|||
pub(crate) fn broadcast(&self) -> &tokio::sync::broadcast::Sender<Response> {
|
||||
&self.broadcast
|
||||
}
|
||||
|
||||
pub(crate) fn shutdown_all(&mut self) {
|
||||
self.abort_senders.clear();
|
||||
}
|
||||
}
|
||||
|
||||
#[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);
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue