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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user