Skip to content

fix: remove completed and expired votekick entries from votekickList#531

Open
xpoes123 wants to merge 1 commit into
qbreader:mainfrom
xpoes123:fix/votekick-list-pruning
Open

fix: remove completed and expired votekick entries from votekickList#531
xpoes123 wants to merge 1 commit into
qbreader:mainfrom
xpoes123:fix/votekick-list-pruning

Conversation

@xpoes123

@xpoes123 xpoes123 commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Completed and abandoned votekick entries were never removed from votekickList in ServerMultiplayerRoomMixin.js, causing two distinct problems: the list grew without bound in long-lived rooms (slow memory leak), and a successful or expired votekick permanently blocked any future votekick against the same user until the server restarted.

Problem

votekickInit short-circuits if an entry for the target already exists:

if (this.votekickList.find(vk => vk.exists(targetId))) { return; }

Because entries were never pruned, a completed kick — or one that simply expired — would prevent any re-initiation for that user for the lifetime of the server process. In rooms with heavy moderation activity, the list also accumulated unboundedly.

Changes

  • Adds this.createdAt = Date.now() to the Votekick constructor (VoteKick.js) so entries carry a timestamp.
  • Removes a target's entry from votekickList on the successful check() branch in both votekickInit and votekickVote, so a re-initiation is possible if the user rejoins after being kicked.
  • Prunes stale entries inside the existing cleanupExpiredBansAndKicks method using BAN_DURATION as the TTL, consistent with how bans and kicks are already expired.

Risk & testing

In-progress votes are never disrupted: entries are only removed on success or after the TTL window has passed. The cleanupExpiredBansAndKicks pruning is additive — the surrounding ban/kick cleanup is unchanged. semistandard and node --check pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@xpoes123 xpoes123 changed the title fix: prune completed/stale votekick entries fix: remove completed and expired votekick entries from votekickList Jun 30, 2026
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