Guard `brokerd_msg` set in order-mode dialog loop
Use `msg.setdefault('brokerd_msg', msg)` instead of blind assignment and
log a warning when the field was already populated.
Specifically, this avoids a self-reference field recursion which causes
crashes when using `tractor.devx.pformat.ppfmt()`..
(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
kraken_stale_ws_token
parent
709269fcf7
commit
8cefc1bdf8
|
|
@ -1022,13 +1022,22 @@ async def open_order_mode(
|
||||||
started.set()
|
started.set()
|
||||||
|
|
||||||
for oid, msg in ems_dialog_msgs.items():
|
for oid, msg in ems_dialog_msgs.items():
|
||||||
|
|
||||||
# HACK ALERT: ensure a resp field is filled out since
|
# HACK ALERT: ensure a resp field is filled out since
|
||||||
# techincally the call below expects a ``Status``. TODO:
|
# techincally the call below expects a ``Status``. TODO:
|
||||||
# parse into proper ``Status`` equivalents ems-side?
|
# parse into proper ``Status`` equivalents ems-side?
|
||||||
# msg.setdefault('resp', msg['broker_details']['resp'])
|
# msg.setdefault('resp', msg['broker_details']['resp'])
|
||||||
# msg.setdefault('oid', msg['broker_details']['oid'])
|
# msg.setdefault('oid', msg['broker_details']['oid'])
|
||||||
msg['brokerd_msg'] = msg
|
ya_msg: dict = msg.setdefault(
|
||||||
|
'brokerd_msg',
|
||||||
|
msg,
|
||||||
|
)
|
||||||
|
if msg is not ya_msg:
|
||||||
|
log.warning(
|
||||||
|
f'A `.brokerd_msg` was already set for ems-dialog msg?\n'
|
||||||
|
f'oid: {oid!r}\n'
|
||||||
|
f'ya_msg: {ya_msg!r}\n'
|
||||||
|
f'msg: {ya_msg!r}\n'
|
||||||
|
)
|
||||||
|
|
||||||
await process_trade_msg(
|
await process_trade_msg(
|
||||||
mode,
|
mode,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue