Kaynağa Gözat

adapter: demote wire corruption to warning, not unexpected error

Protobuf ParseFromString failures on the realtime WebSocket are
now caught by their cause type (DecodeError) and logged at WARNING
with 'wire corruption' instead of 'unexpected realtime error'.
This removes the misleading log line while keeping the reconnect
behavior unchanged.

No vendored files edited.
Paul Klumpp 3 hafta önce
ebeveyn
işleme
b16ded4713
1 değiştirilmiş dosya ile 13 ekleme ve 5 silme
  1. 13 5
      adapter.py

+ 13 - 5
adapter.py

@@ -1753,11 +1753,19 @@ class ChattoAdapter(BasePlatformAdapter):
                     delay,
                 )
             except Exception as exc:
-                logger.warning(
-                    "Chatto: unexpected realtime error: %s, reconnecting in %.1fs",
-                    exc,
-                    delay,
-                )
+                cause = exc.__cause__
+                if cause is not None and "ParseFromString" in str(type(cause).__name__):
+                    logger.warning(
+                        "Chatto: realtime wire corruption (%s), reconnecting in %.1fs",
+                        cause,
+                        delay,
+                    )
+                else:
+                    logger.warning(
+                        "Chatto: unexpected realtime error: %s, reconnecting in %.1fs",
+                        exc,
+                        delay,
+                    )
 
             if self._closing:
                 return