Repository navigation
feat(proxy): expose network-wide player counts per backend server - #15
Conversation
A proxy can only count the players connected to itself, so with two proxies in front of one lobby each of them reports half of it. ProxyService now answers for the whole network, via the registered PlayerSessionQuery. Returns null when the network cannot be asked, rather than falling back to this proxy's own numbers: a local count is indistinguishable from a network count once it is rendered, and silently showing the wrong one is the bug being fixed.
|
Zwei Sachen, bevor das gemerged wird — CI ist grün, die Doku im Diff ist gut (besonders "null statt proxy-lokalem Fallback", genau richtig). 1. Abstrakte Methode auf einer publizierten Schnittstelle. 2. Die Zahl kann heute niemand beantworten.
So gemerged liefert der neue Call überall Deshalb bewusst als Draft gelassen statt auf ready gesetzt. |
|
Nachtrag: mein erster Einwand hat sich erledigt, der zweite nicht ganz. Erledigt — der fehlende Offen — beantworten kann die Zahl trotzdem noch niemand: der Pfad endet in service-player, und dort hängt es an der Reihenfolge. Reihenfolge: contracts#71 → Contracts-Release → service-player#77 → dieser PR. |
Why
ProxyServiceis the seam every plugin uses to reason about players on other proxies — resolve a name, send a message, transfer them. The one thing it could not do was count them, so/agonesfell back to Velocity'splayersConnected, which is proxy-local by definition and reported "1 player" in a lobby holding two.What
PlayerSessionQuery.countPlayersByServer()— implemented by plugin-player, backed by service-player's session table.ProxyService.getNetworkPlayerCounts()— what consumers call.NetworkPlayerCounts(byServer, total). A server nobody is on is absent rather than zero;totalincludes players not yet on a backend server, so it can exceed the sum.Returns null, not a local fallback. Every other
ProxyServicemethod degrades to a local answer when noPlayerSessionQueryis registered, and that is right for them — a local player is a correct answer to "where is this player". It is wrong for a count: a proxy-local number looks exactly like a network number once rendered, and quietly showing it is the bug. Callers should say the figure is proxy-local instead.Merge order
2 of 5. Depends on nothing; blocks the consumer.
library-grpc-contracts-player0.4.0plugin-proxy-api(0.2.0)service-player— implement the RPCplugin-player— implementcountPlayersByServer()plugin-agones—/agonesreads the network numbersVerified
./gradlew buildgreen. Published locally asgg.grounds:plugin-proxy-api:0.2.0and compiled plugin-player and plugin-agones against it.