forked from goodboy/tractor
1
0
Fork 0

Suppress broken resources errors in `Portal.cancel_actor()`

acked_backup
Tyler Goodlet 2021-12-02 14:14:49 -05:00
parent 14f84571fb
commit 08e9593306
1 changed files with 6 additions and 3 deletions

View File

@ -215,7 +215,7 @@ class Portal:
''' '''
if not self.channel.connected(): if not self.channel.connected():
log.cancel("This portal is already closed can't cancel") log.cancel("This channel is already closed can't cancel")
return False return False
log.cancel( log.cancel(
@ -239,9 +239,12 @@ class Portal:
# if we get here some weird cancellation case happened # if we get here some weird cancellation case happened
return False return False
except trio.ClosedResourceError: except (
trio.ClosedResourceError,
trio.BrokenResourceError,
):
log.cancel( log.cancel(
f"{self.channel} for {self.channel.uid} was already closed?") f"{self.channel} for {self.channel.uid} was already closed or broken?")
return False return False
async def run_from_ns( async def run_from_ns(