This commit is contained in:
Mateusz Gruszczyński
2026-09-04 11:43:37 +02:00
parent 9b4fafdfa6
commit ade221bb76
16 changed files with 338 additions and 40 deletions
+2 -3
View File
@@ -198,9 +198,8 @@ fn record_poll_failure(device: &mut Device, error: &str) {
fn register_device_failure(state: &AppState, device: &mut Device, error: &str) -> Result<(), AppError> {
record_poll_failure(device, error);
state.db.save_device(device)?;
// Command failures can change online/communication health without a device.updated frame.
// Keep the materialized plan current explicitly instead of relying on log-event prefixes.
state.invalidate_control_plan();
// Command failures change live communication health; publish the updated snapshot immediately.
state.broadcast("device.updated", serde_json::to_value(&*device)?);
state.log("warn", "device.communication_error", &format!("{}: {error}", device.name), json!({
"device_id": device.id,
"consecutive_failures": device.communication_failures,