From 47e7baa0c90d391b526ba6bf97f78ec47309e5ce Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 8 Jun 2021 15:56:34 -0400 Subject: [PATCH] Ensure paperboi is shield killed on teardown --- piker/clearing/_paper_engine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/piker/clearing/_paper_engine.py b/piker/clearing/_paper_engine.py index e669fd42..788e7674 100644 --- a/piker/clearing/_paper_engine.py +++ b/piker/clearing/_paper_engine.py @@ -460,4 +460,10 @@ async def open_paperboi( loglevel=loglevel, ) as (ctx, first): - yield ctx, first + try: + yield ctx, first + + finally: + # be sure to tear down the paper service on exit + with trio.CancelScope(shield=True): + await portal.cancel_actor()