mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-03-26 17:03:09 +00:00
fix(appd): combine set_state and broadcast into one lock acquisition on READY
The two consecutive registry lock acquisitions after READY left a window where session state was Running but the AppReady broadcast had not yet been sent. A concurrent reader winning the lock in that window would observe Running without a corresponding event. Combining into one acquisition closes the window.
This commit is contained in:
parent
e02ce5722d
commit
cd13f4cd3a
1 changed files with 8 additions and 8 deletions
|
|
@ -315,14 +315,14 @@ pub(crate) async fn supervise(
|
|||
|
||||
let app_shell = match ready_result {
|
||||
Some(Ok(Ok(remaining_stdout))) => {
|
||||
registry
|
||||
.lock()
|
||||
.await
|
||||
.set_state(session_id, AppStateKind::Running);
|
||||
let _ = registry.lock().await.broadcast().send(Response::AppReady {
|
||||
session_id,
|
||||
app_id: app_id.to_owned(),
|
||||
});
|
||||
{
|
||||
let mut reg = registry.lock().await;
|
||||
reg.set_state(session_id, AppStateKind::Running);
|
||||
let _ = reg.broadcast().send(Response::AppReady {
|
||||
session_id,
|
||||
app_id: app_id.to_owned(),
|
||||
});
|
||||
}
|
||||
tracing::info!(session_id, %app_id, "app ready");
|
||||
tokio::spawn(drain_stdout(remaining_stdout, session_id));
|
||||
spawn_app_shell(session_id, app_id).await
|
||||
|
|
|
|||
Loading…
Reference in a new issue