From c44627ab522f07eae7f6af518070e0d0404f0763 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 4 Apr 2023 13:31:39 -0400 Subject: [PATCH] Cancel the `OrderClient` sync-method relay task on exit --- piker/clearing/_client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/piker/clearing/_client.py b/piker/clearing/_client.py index 8f531d6d..c9ad0d67 100644 --- a/piker/clearing/_client.py +++ b/piker/clearing/_client.py @@ -240,7 +240,10 @@ async def open_ems( ''' broker, symbol, suffix = unpack_fqme(fqme) - async with maybe_open_emsd(broker) as portal: + async with maybe_open_emsd( + broker, + loglevel=loglevel, + ) as portal: mod = get_brokermod(broker) if ( @@ -304,3 +307,6 @@ async def open_ems( accounts, dialogs, ) + + # stop the sync-msg-relay task on exit. + n.cancel_scope.cancel()