Skip to content

Commit

Permalink
note some issues in the code
Browse files Browse the repository at this point in the history
  • Loading branch information
belm0 committed Apr 15, 2022
1 parent 64c5fe4 commit 1e8f8e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/purerpc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .anyio_monkeypatch import apply_monkeypatch as _apply_anyio_monkeypatch

# TODO: don't hack anyio.run()!
_apply_anyio_monkeypatch()


Expand Down
3 changes: 3 additions & 0 deletions src/purerpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,12 @@ async def request_received(self, stream: GRPCProtoStream):
except RpcFailedError as error:
await stream.close(error.status)
except:
# TODO: limit catch to Exception, so async cancel can propagate
log.warning("Got exception while writing response stream",
exc_info=log.getEffectiveLevel() == logging.DEBUG)
await stream.close(Status(StatusCode.CANCELLED, status_message=repr(sys.exc_info())))
except:
# TODO: limit catch to Exception, so async cancel can propagate
log.warning("Got exception in request_received",
exc_info=log.getEffectiveLevel() == logging.DEBUG)

Expand All @@ -236,5 +238,6 @@ async def __call__(self, socket):
async for stream in self.grpc_socket.listen():
await task_group.spawn(self.request_received, stream)
except:
# TODO: limit catch to Exception, so async cancel can propagate
log.warning("Got exception in main dispatch loop",
exc_info=log.getEffectiveLevel() == logging.DEBUG)

0 comments on commit 1e8f8e9

Please sign in to comment.