Skip to content

Commit

Permalink
Shield around root actor cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Apr 29, 2021
1 parent 542549d commit 1eb12e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tractor/_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,13 @@ async def open_root_actor(
logger.exception("Actor crashed:")
await _debug._maybe_enter_pm(err)

# always re-raise
raise

finally:
logger.info("Shutting down root actor")
await actor.cancel()
with trio.CancelScope(shield=True):
await actor.cancel()
finally:
_state._current_actor = None
logger.info("Root actor terminated")
Expand Down

0 comments on commit 1eb12e5

Please sign in to comment.