From 683b05beb14b4c97c0a016d67fbbbef4195a385d Mon Sep 17 00:00:00 2001 From: Logan Date: Mon, 1 Jun 2026 01:06:49 -0400 Subject: [PATCH] Silence ERROR log for status messages from deleted nodes _handle_status was calling doc_update unconditionally, which throws a 404 when a node has been deleted from the UI but is still running and sending heartbeats. Catch the "No document to update" error and log at info level instead of bubbling up to the dispatch error handler. --- drb-c2-core/app/internal/mqtt_handler.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/drb-c2-core/app/internal/mqtt_handler.py b/drb-c2-core/app/internal/mqtt_handler.py index c4b9b84..5839385 100644 --- a/drb-c2-core/app/internal/mqtt_handler.py +++ b/drb-c2-core/app/internal/mqtt_handler.py @@ -127,10 +127,16 @@ class MQTTHandler: status = payload.get("status") if not status: return - await fstore.doc_update("nodes", node_id, { - "status": status, - "last_seen": datetime.now(timezone.utc).isoformat(), - }) + try: + await fstore.doc_update("nodes", node_id, { + "status": status, + "last_seen": datetime.now(timezone.utc).isoformat(), + }) + except Exception as e: + if "No document to update" in str(e): + logger.info(f"Status from deleted/unknown node {node_id} — ignoring (no Firestore doc)") + else: + raise # ------------------------------------------------------------------ # Metadata — call_start / call_end events