Skip to content

Commit

Permalink
Tolerate one decode error; may have been a registry ping
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Oct 4, 2021
1 parent b7409d7 commit fbc6905
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tractor/_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit fbc6905

Please sign in to comment.