-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: keep old orders around on websocket reconnect #756
Conversation
reset = false, | ||
) | ||
// fills is sometimes null on this message, doesn't mean there are none | ||
if (fills != null) { |
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 think this is why the fills were disappearing earlier too. This message has null fills even though there are some.
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.
reset = false is passed here, so it shouldn't overwrite the existing fills when payload is null.
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.
even when it's true fills is null though
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 mean processFills() handles the case when fills == null already... if fill == null, the existing fills won't be overwritten
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.
subaccount.fills = fillsProcessor.process(
existing = if (reset) null else subaccount.fills,
payload = payload ?: emptyList(),
subaccountNumber = subaccount.subaccountNumber,
)
if reset is true it's going to nuke it, which we don't want because payload is also null
@@ -250,7 +253,6 @@ internal open class SubaccountProcessor( | |||
existing.assetPositions = assetPositionsProcessor.process( | |||
payload = payload.assetPositions, | |||
) | |||
existing.orders = null |
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.
not sure why we did this, also in the non-static codepath. I get that this message contains orders so we can overwrite it, but then we miss out on filled orders in that table.
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.
This fix makes sense... Just need to test the scenarios of user logging out or changing the env. I think the entire subaccount state should be nuked in those cases, so that the order list becomes empty.
Feels like the upside of merging this isn't really worth the possible downside so close to unlimited cut. |
So we can render old notifications.