Repository navigation
Add game-wide player counts - #406
Merged
Merged
Conversation
koenbollen
reviewed
Oct 23, 2026
koenbollen
reviewed
Oct 23, 2026
erikdubbelboer
force-pushed
the
getPlayerCounts
branch
from
October 24, 2026 04:40
c7fe6c0 to
e2d30e1
Compare
Add network.getPlayerCounts() to return online and in-lobby session counts for the current game, including private lobbies. Also mark peers disconnected when they explicitly close their network. Previously they remained marked connected until timeout, even though they had already left. This would keep the eligible for leader election.
erikdubbelboer
force-pushed
the
getPlayerCounts
branch
from
October 26, 2026 04:48
e2d30e1 to
5dc68ed
Compare
ErikSom
approved these changes
Oct 27, 2026
koenbollen
reviewed
Oct 27, 2026
| WHERE peers.peer = ANY(game_lobbies.peers) AND (`+where+`) | ||
| )) | ||
| FROM peers | ||
| WHERE game = $1 AND disconnected = FALSE |
Collaborator
There was a problem hiding this comment.
This looks like a pretty heavy query for a player count. Doesn't the WITH game_lobbies keep all lobbies in memory?
Member
Author
There was a problem hiding this comment.
It's not MATERIALIZED so it will just be inlined instead of running that query first and then using the result for the outer query.
koenbollen
approved these changes
Oct 28, 2026
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.
Add
network.getPlayerCounts()to return online and in-lobby session counts for the current game, including private lobbies.Also mark peers disconnected when they explicitly close their network. Previously they remained marked connected until timeout, even though they had already left. This would keep the eligible for leader election.