Report `trio.Cancelled` when exhausting portals..

For reliable remote cancellation we need to "report" `trio.Cancelled`s
(just like any other error) when exhausting a portal such that the
caller can make decisions about cancelling the respective actor if need
be.

Resolves 
bug_in_debug
Tyler Goodlet 2020-10-12 23:28:36 -04:00
parent 0e344eead8
commit 79c38b04e7
1 changed files with 5 additions and 0 deletions
tractor

View File

@ -112,6 +112,11 @@ async def exhaust_portal(
except (Exception, trio.MultiError) as err: except (Exception, trio.MultiError) as err:
# we reraise in the parent task via a ``trio.MultiError`` # we reraise in the parent task via a ``trio.MultiError``
return err return err
except trio.Cancelled as err:
# lol, of course we need this too ;P
# TODO: merge with above?
log.warning(f"Cancelled result waiter for {portal.actor.uid}")
return err
else: else:
log.debug(f"Returning final result: {final}") log.debug(f"Returning final result: {final}")
return final return final