From e150fa683d118f6fe4ae0782c3b13495f4faab9f Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Thu, 1 Aug 2024 16:13:20 -0400 Subject: [PATCH] Also ignore grpc internal error --- jumpstarter/common/streams.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/jumpstarter/common/streams.py b/jumpstarter/common/streams.py index 3d487334..b1f039d6 100644 --- a/jumpstarter/common/streams.py +++ b/jumpstarter/common/streams.py @@ -22,23 +22,18 @@ async def decapsulate_stream(tx, rx, tg): async for frame in rx: match frame.frame_type: case router_pb2.FRAME_TYPE_DATA: - try: - await tx.send(frame.payload) - except (BrokenResourceError, ClosedResourceError): - pass - case router_pb2.FRAME_TYPE_PING: - pass + await tx.send(frame.payload) case router_pb2.FRAME_TYPE_GOAWAY: - break + await tx.send_eof() case _: pass - # workaround for grpc - async for _ in rx: - pass - # ignore rpc cancellation + # ignore peer disconnet + except BrokenResourceError: + pass + # ignore rpc cancellation and internal error except grpc.aio.AioRpcError as e: match e.code(): - case grpc.StatusCode.CANCELLED: + case grpc.StatusCode.CANCELLED | grpc.StatusCode.INTERNAL: pass case _: raise