Skip to content

Commit

Permalink
Also ignore grpc internal error
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCao committed Aug 1, 2024
1 parent 1db0d8b commit e150fa6
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions jumpstarter/common/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 30 in jumpstarter/common/streams.py

View workflow job for this annotation

GitHub Actions / typos

"disconnet" should be "disconnect".
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
Expand Down

0 comments on commit e150fa6

Please sign in to comment.