From f38eef2bf4d6f1051d2eadc203af089e525689bd Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 5 Jul 2022 09:06:53 -0400 Subject: [PATCH] Make ems relay loop report on brokerd `.reqid` changes --- piker/clearing/_ems.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 051ad30e..b481c5c0 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -88,7 +88,8 @@ def mk_check( @dataclass class _DarkBook: - '''EMS-trigger execution book. + ''' + EMS-trigger execution book. Contains conditions for executions (aka "orders" or "triggers") which are not exposed to brokers and thus the market; i.e. these are @@ -652,6 +653,13 @@ async def translate_and_relay_brokerd_events( else: # check for existing live flow entry entry = book._ems_entries.get(oid) + old_reqid = entry.reqid + + if old_reqid and old_reqid != reqid: + log.warning( + f'Brokerd order id change for {oid}:\n' + f'{old_reqid} -> {reqid}' + ) # initial response to brokerd order request if name == 'ack': @@ -662,6 +670,10 @@ async def translate_and_relay_brokerd_events( # a ``BrokerdOrderAck`` **must** be sent after an order # request in order to establish this id mapping. book._ems2brokerd_ids[oid] = reqid + log.info( + 'Rx ACK for order\n' + f'oid: {oid} -> reqid: {reqid}' + ) # new order which has not yet be registered into the # local ems book, insert it now and handle 2 cases: