-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add insert and delete APIs to orderbook WS #2418
Conversation
d31ad05
to
5ce995d
Compare
5ce995d
to
7c6f8ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the feature, but I'm wondering if we have a mxiup with trader_order_id
and order_id
🙈
}) | ||
.await??; | ||
|
||
let _ = state.tx_orderbook_feed.send(Message::DeleteOrder(order_id)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
order_id
is the trader_order_id
right? If so, the traders receiving the DeleteOrder
msg might not know what todo with this.
The user connected to the websocket shouldn't know about the trader_order_id
, so did this ever work? 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I made a mistake. I'll test it again locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you didn't it's been like that before. Maybe this was a reason why we saw outdated orders on the client side...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I've been thinking about it and I don't see the problem with those warnings we get on the app.
As far as I can tell, what happens is:
- The maker generates an order.
- The maker deletes the order.
- The app starts and connects to the coordinator's WS, getting an
AllOrders
message that does not include the deleted order. - The WS still sends the app the corresponding
DeleteOrder
message from step 2.
I don't understand why the "outdated" message is delivered to the app, but I think we should demote the WARN to DEBUG because I think this is harmless.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into it and we are actually sending the trader_order_id
to all users 🙈 It's probably not an issue, but I think it wasn't meant to be used like that:
Here are we mapping the trader_order_id
from the db to order.id
for the orders we are returning to the users.
10101/coordinator/src/orderbook/db/orders.rs
Line 114 in 7c6f8ee
id: value.trader_order_id, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why the "outdated" message is delivered to the app, but I think we should demote the WARN to DEBUG because I think this is harmless.
Imho this happens because we are here also clinsing outdated orders here and we might have a race condition where the maker deletes an order and this is run
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into it and we are actually sending the
trader_order_id
to all users 🙈 It's probably not an issue, but I think it wasn't meant to be used like that:Here are we mapping the
trader_order_id
from the db toorder.id
for the orders we are returning to the users.10101/coordinator/src/orderbook/db/orders.rs
Line 114 in 7c6f8ee
id: value.trader_order_id,
Yeah, that makes sense.
Did we ever have an order ID that wasn't the trader order ID though? I can't find another one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, on DB level we have a different one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but that one has only ever been used internally:
// this id is only internally but needs to be here or diesel complains
#[allow(dead_code)]
pub id: i32,
Add insert and delete APIs to orderbook WS
Related to https://github.com/get10101/aristides/issues/39.