From 98bbf8e0df1d048a13ae1d85b5506e9bc074a834 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 5 Jul 2021 13:37:09 -0400 Subject: [PATCH] Move join event trigger to direct exit path --- tractor/_trionics.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tractor/_trionics.py b/tractor/_trionics.py index 894ab7d..eea3aae 100644 --- a/tractor/_trionics.py +++ b/tractor/_trionics.py @@ -252,6 +252,12 @@ async def _open_and_supervise_one_cancels_all_nursery( f"Waiting on subactors {anursery._children} " "to complete" ) + + # Last bit before first nursery block ends in the case + # where we didn't error in the caller's scope + log.debug("Waiting on all subactors to complete") + anursery._join_procs.set() + except BaseException as err: # if the caller's scope errored then we activate our # one-cancels-all supervisor strategy (don't @@ -292,11 +298,6 @@ async def _open_and_supervise_one_cancels_all_nursery( else: raise - # Last bit before first nursery block ends in the case - # where we didn't error in the caller's scope - log.debug("Waiting on all subactors to complete") - anursery._join_procs.set() - # ria_nursery scope end # XXX: do we need a `trio.Cancelled` catch here as well?