Handle broken channels more resiliently on teardown

remote_task_cancelling
Tyler Goodlet 2018-12-15 02:19:47 -05:00
parent 47b531a43a
commit d492236f3a
1 changed files with 5 additions and 2 deletions

View File

@ -294,8 +294,11 @@ class Actor:
# # XXX: is this necessary (GC should do it?) # # XXX: is this necessary (GC should do it?)
if chan.connected(): if chan.connected():
log.debug(f"Disconnecting channel {chan}") log.debug(f"Disconnecting channel {chan}")
try:
await chan.send(None) await chan.send(None)
await chan.aclose() await chan.aclose()
except trio.BrokenResourceError:
log.exception(f"Channel for {chan.uid} was already zonked..")
async def _push_result(self, actorid, cid: str, msg: dict) -> None: async def _push_result(self, actorid, cid: str, msg: dict) -> None:
"""Push an RPC result to the local consumer's queue. """Push an RPC result to the local consumer's queue.