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 disconnected session activity #675

Merged

Conversation

boatbomber
Copy link
Member

When a session is disconnected, the apiContext long-polling for messages continues until resolved/rejected. This means that even after a session is disconnected, a message can be received and handled.

This leads to bad behavior, as the session was already cleaned up and the message cannot be handled correctly. The instance map was cleaned up upon disconnect, so it will warn about unapplied changes to unknown instances. (Like #512)

It's very easy to repro:
Connect a session, disconnect it, then save a change.

demo.mp4

This PR fixes that neatly by tracking all active requests in a map, and cancelling their promises when we disconnect.

Copy link
Member

@kennethloeffler kennethloeffler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silly bug, but your solution looks great - no complaints here.

@boatbomber boatbomber added the status: needs review This work is mostly done, but just needs work to integrate and merge it. label Jun 1, 2023
@Kampfkarren Kampfkarren enabled auto-merge (squash) June 1, 2023 15:17
@Kampfkarren Kampfkarren disabled auto-merge June 1, 2023 15:17
@Kampfkarren Kampfkarren merged commit 6b0f7f9 into rojo-rbx:master Jun 1, 2023
@boatbomber boatbomber deleted the fix-disconnected-session-activity branch June 2, 2023 18:03
Dekkonot pushed a commit to UpliftGames/rojo that referenced this pull request Jan 11, 2024
When a session is disconnected, the apiContext long-polling for messages
continues until resolved/rejected. This means that even after a session
is disconnected, a message can be received and handled.

This leads to bad behavior, as the session was already cleaned up and
the message cannot be handled correctly. The instance map was cleaned up
upon disconnect, so it will warn about unapplied changes to unknown
instances. (Like rojo-rbx#512)

It's very easy to repro:
Connect a session, disconnect it, then save a change.


https://github.com/rojo-rbx/rojo/assets/40185666/846a7269-7043-4727-9f9c-b3ac55a18a3a

-----------

This PR fixes that neatly by tracking all active requests in a map, and
cancelling their promises when we disconnect.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs review This work is mostly done, but just needs work to integrate and merge it.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants