Add `Status.cancel_called: bool`

This is a simpler (and oddly more `trio`-nic and/or SC) way to handle
the cancelled-before-acked race for order dialogs. Will allow keeping
the `.req` field as solely an `Order` msg.
even_moar_kraken_order_fixes
Tyler Goodlet 2022-10-28 15:11:04 -04:00
parent fa368b1263
commit 71a11a23bd
1 changed files with 5 additions and 2 deletions

View File

@ -110,7 +110,6 @@ class Cancel(Struct):
action: str = 'cancel'
oid: str # uuid4
symbol: str
account: str = ''
# --------------
@ -144,7 +143,7 @@ class Status(Struct):
# (eg. the Order/Cancel which causes this msg) and
# acts as a back-reference to the corresponding
# request message which was the source of this msg.
req: Optional[Order | Cancel] = None
req: Order | None = None
# XXX: better design/name here?
# flag that can be set to indicate a message for an order
@ -153,6 +152,10 @@ class Status(Struct):
# might want to "track" using piker UIs/systems).
src: Optional[str] = None
# set when a cancel request msg was set for this order flow dialog
# but the brokerd dialog isn't yet in a cancelled state.
cancel_called: bool = False
# for relaying a boxed brokerd-dialog-side msg data "through" the
# ems layer to clients.
brokerd_msg: dict = {}