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

Actually remove dungeon sessions #862

Merged
merged 5 commits into from
Jun 8, 2024
Merged

Actually remove dungeon sessions #862

merged 5 commits into from
Jun 8, 2024

Conversation

SapiensAnatis
Copy link
Owner

@SapiensAnatis SapiensAnatis commented Jun 6, 2024

Speculative fix for random auto-repeat glitches throwing up stale data, and something we should be doing anyway.

Today, when you finish a dungeon, the session remains in the cache for the remainder of its expiry time, because issues were previously encountered with the client retrying record requests if they take too long, and then encountering errors because the session had been deleted on the first request.

Now that the codebase makes better use of CancellationToken, this is much less likely if we put the eviction of the session right at the end of the response method. It is still possible if the request is cancelled during serialization, however. If we encounter issues we can make the RemoveDungeon method instead mark the session to be removed in 1 minute's time or similar.

Also includes a refactoring of the DungeonService to implement a unit-of-work pattern, where the current session can be cached and modified in-memory without round-trips to the cache. This is primarily aimed at the DungeonStart logic which can require several updates after creating the session, arising from how the code is structured.

Finally, makes sessions keyed by viewer ID, so that it isn't possible to get another player's session. It probably wasn't really possible before, given the astronomical likelihood of guessing/colliding GUIDs, but it makes sense to segregate this data by tenant all the same. This key change is breaking, and the server should be taken down during the deployment.

SapiensAnatis and others added 3 commits June 6, 2024 22:56
Speculative fix for random auto-repeat glitches throwing up stale data, and something we should be doing anyway.

Today, when you finish a dungeon, the session remains in the cache for the remainder of its expiry time, because issues were previously encountered with the client retrying record requests after the session had been evicted.

Now that the codebase makes better use of CancellationToken, this is much less likely if we put the eviction of the session right at the end of the response method. It is still possible if the request is cancelled during serialization, however. If we encounter issues we can make the RemoveDungeon method instead mark the session to be removed in 1 minute's time or similar.

Also includes a refactoring of the DungeonService to implement a unit-of-work pattern, where the current session can be cached and modified in-memory without round-trips to the cache. This is primarily aimed at the DungeonStart logic which can require several updates after creating the session, arising from how the code is structured.

Finally, makes sessions keyed by viewer ID, so that it isn't possible to get another player's session. It probably wasn't really possible before, given the astronomical likelihood of guessing/colliding GUIDs, but it makes sense to segregate this data by tenant all the same. **This key change is breaking, and the server should be taken down during the deployment.**
@SapiensAnatis
Copy link
Owner Author

SapiensAnatis commented Jun 8, 2024

Apparently #861 fixed a lot of the reported issues with auto-repeat, to my surprise. This change still makes sense though as it will clean up the cache and remove some automapper usage in the dungeon code

@SapiensAnatis SapiensAnatis marked this pull request as ready for review June 8, 2024 15:40
@SapiensAnatis SapiensAnatis merged commit 459e7ba into main Jun 8, 2024
6 checks passed
@SapiensAnatis SapiensAnatis deleted the fix/dungeon-session branch June 8, 2024 18:31
SapiensAnatis added a commit that referenced this pull request Jun 30, 2024
Today, when you finish a dungeon, the session remains in the cache for
the remainder of its expiry time, because issues were previously
encountered with the client retrying record requests if they take too
long, and then encountering errors because the session had been deleted
on the first request.

Now that the codebase makes better use of CancellationToken, this is
much less likely if we put the eviction of the session right at the end
of the response method. It is still possible if the request is cancelled
during serialization, however. If we encounter issues we can make the
RemoveDungeon method instead mark the session to be removed in 1
minute's time or similar.

Also includes a refactoring of the DungeonService to implement a
unit-of-work pattern, where the current session can be cached and
modified in-memory without round-trips to the cache. This is primarily
aimed at the DungeonStart logic which can require several updates after
creating the session, arising from how the code is structured.

Finally, makes sessions keyed by viewer ID, so that it isn't possible to
get another player's session. It probably wasn't really possible before,
given the astronomical likelihood of guessing/colliding GUIDs, but it
makes sense to segregate this data by tenant all the same. **This key
change is breaking, and the server should be taken down during the
deployment.**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant