From 135459ca25c70d902e69b3c904ddaf9c81c55f6e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 30 Sep 2021 11:32:28 -0400 Subject: [PATCH] Tolerate one decode error; may have been a registry ping --- tractor/_ipc.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tractor/_ipc.py b/tractor/_ipc.py index 6f3fffa2b..b8d0437b3 100644 --- a/tractor/_ipc.py +++ b/tractor/_ipc.py @@ -177,17 +177,19 @@ async def _iter_packets(self) -> typing.AsyncGenerator[dict, None]: log.transport(f"received {msg_bytes}") # type: ignore try: - assert not last_decode_failed yield self.decode(msg_bytes) except ( msgspec.DecodingError, UnicodeDecodeError, ): - # ignore decoding errors for now and assume they have to - # do with a channel drop - hope that receiving from the - # channel will raise an expected error and bubble up. - log.error('`msgspec` failed to decode!?') - last_decode_failed = True + if not last_decode_failed: + # ignore decoding errors for now and assume they have to + # do with a channel drop - hope that receiving from the + # channel will raise an expected error and bubble up. + log.error('`msgspec` failed to decode!?') + last_decode_failed = True + else: + raise async def send(self, data: Any) -> None: async with self._send_lock: