From 003fa6254f2da94b7d5fbf6af9bc670b2d4f091e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 22 Jun 2021 13:19:38 -0400 Subject: [PATCH] Don't forget to pop the brokerd dialogue on teardown.. --- piker/clearing/_ems.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 54497a5d..5bdf34d3 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -514,8 +514,11 @@ async def translate_and_relay_brokerd_events( ).dict() ) - if client_flow_complete: - router.dialogues.pop(oid) + # TODO: do we want this to keep things cleaned up? + # it might require a special status from brokerd to affirm the + # flow is complete? + # if client_flow_complete: + # router.dialogues.pop(oid) async def process_client_order_cmds( @@ -810,7 +813,12 @@ async def maybe_open_brokerd_trades_dialogue( _router.relays[broker] = (positions, brokerd_trades_stream) - yield positions, brokerd_trades_stream + try: + yield positions, brokerd_trades_stream + + finally: + # remove from cache so next client will respawn if needed + _router.relays.pop(broker) @tractor.context