Skip to content
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

Closed
wants to merge 3 commits into from

Conversation

tyleroooo
Copy link
Contributor

So we can render old notifications.

reset = false,
)
// fills is sometimes null on this message, doesn't mean there are none
if (fills != null) {
Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@tyleroooo
Copy link
Contributor Author

Feels like the upside of merging this isn't really worth the possible downside so close to unlimited cut.

@tyleroooo tyleroooo closed this Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants