Don't forget to pop the brokerd dialogue on teardown..

minimal_brokerd_trade_dialogues
Tyler Goodlet 2021-06-22 13:19:38 -04:00
parent 8f05254c80
commit 003fa6254f
1 changed files with 11 additions and 3 deletions

View File

@ -514,8 +514,11 @@ async def translate_and_relay_brokerd_events(
).dict() ).dict()
) )
if client_flow_complete: # TODO: do we want this to keep things cleaned up?
router.dialogues.pop(oid) # 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( async def process_client_order_cmds(
@ -810,7 +813,12 @@ async def maybe_open_brokerd_trades_dialogue(
_router.relays[broker] = (positions, brokerd_trades_stream) _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 @tractor.context