소스 검색

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 주 전
부모
커밋
b16ded4713
1개의 변경된 파일과 13개의 추가작업 그리고 5개의 파일을 삭제
  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