fix: reclaim empty rooms and cancel their cleanup intervals on disconnect#532
Open
xpoes123 wants to merge 1 commit into
Open
fix: reclaim empty rooms and cancel their cleanup intervals on disconnect#532xpoes123 wants to merge 1 commit into
xpoes123 wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User-created multiplayer rooms leaked two resources that were never reclaimed: the room entry in
tossupBonusRoomspersisted indefinitely after all players left, and the per-roomsetIntervalforcleanupExpiredBansAndKicksran for the life of the process with no way to stop it.Problem
In
ServerMultiplayerRoomMixin.js, the cleanup interval was started with no retained handle:And in
handle-wss-connection.js, rooms were added totossupBonusRoomsbutcloseConnectionnever deleted them. Over time, both the map and the timer count grew without bound, and the room-list endpoints iterated a map full of empty, unreachable rooms.Changes
this.cleanupIntervalso it can be cancelled.closeConnection, afterleave, checks whether the room is now empty and idle (no tossup or bonus in progress). If so, and the room is neither permanent nor verified, callsclearInterval(this.cleanupInterval)and firesthis.onEmpty?.().handle-wss-connection.js, wiresonEmptyat creation time todelete tossupBonusRooms[roomName].BONUS_PROGRESS_ENUM(previously unused in this file) to support the idle check.Risk & testing
Permanent and verified rooms are explicitly excluded from the reclaim path. Rooms with a question in progress are skipped (the idle guard); they will be reclaimed the next time they empty between questions. Rejoining a deleted room name creates a fresh room as before.
semistandardandnode --checkpass.