fix(engine): push WS immediately on notify wake-up
When auto_enabled or fault_locked changes externally, the engine task wakes via notify but previously only pushed WS on the next state transition (potentially seconds later). Now push the fresh runtime immediately in the notify.notified() arm so the frontend reflects the change without delay. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8c1b7b636d
commit
dd0e782450
|
|
@ -94,7 +94,12 @@ async fn unit_task(state: AppState, store: Arc<ControlRuntimeStore>, unit_id: Uu
|
||||||
if !runtime.auto_enabled || runtime.fault_locked || runtime.comm_locked {
|
if !runtime.auto_enabled || runtime.fault_locked || runtime.comm_locked {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
_ = fault_tick.tick() => {}
|
_ = fault_tick.tick() => {}
|
||||||
_ = notify.notified() => {}
|
_ = notify.notified() => {
|
||||||
|
// Push fresh runtime immediately so the frontend reflects the change
|
||||||
|
// (e.g. auto_enabled toggled) without waiting for the next state transition.
|
||||||
|
let runtime = store.get_or_init(unit_id).await;
|
||||||
|
push_ws(&state, &runtime).await;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue