Explorar o código

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 hai 3 semanas
pai
achega
b16ded4713
Modificáronse 1 ficheiros con 13 adicións e 5 borrados
  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