Fix missing Discord notification for first player join after reconnect - #25
Merged
Merged
Conversation
… reconnect The suppress-player-events flag (set on every RCON (re)connect to avoid notifying for players already on the server) was only ever cleared inside the branch of ParsePlayerList that processes a non-empty player list. If the very first playerlist poll after a reconnect found nobody online yet - the common case right after a server restart, since players take time to reconnect - the method returned early before reaching that code, leaving the flag stuck true. Whoever joined live before the next poll (which finally saw players and cleared the flag) had their connect webhook silently and permanently skipped, even though their eventual disconnect fired normally. Moved the flag-clearing logic to run right after every successful poll, regardless of whether the returned list is empty.
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.
Fixes a bug where the first player to join after the panel reconnects to a Rust server (e.g. after a server restart) never gets a 'player came online' Discord message, even though their disconnect fires fine and subsequent reconnects work normally.
Root cause: the suppress-player-events flag (set on every reconnect to avoid notifying for players already on the server) was only cleared inside the non-empty-playerlist branch of ParsePlayerList. If the first poll after reconnect found zero players online yet - the normal case right after a restart, since players take a bit to reconnect - the method returned early before ever clearing the flag. It stayed stuck true until a later poll found someone already online, silently dropping the connect notification for whoever joined live in between.
Fix: clear the flag right after every successful poll, regardless of whether the list is empty.