fix(dashboard): a closed Game clients box keeps its links to worlds with idle players

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 23:15:31 -05:00
parent f86f173cae
commit 2e7bea3be8
2 changed files with 10 additions and 1 deletions

View File

@@ -166,7 +166,9 @@
if (split) {
var c = rates(split.clients);
if (any(c)) edge('clients', id, c.packets_in, c.bytes_in, c.packets_out, c.bytes_out, true);
// A player standing still sends nothing for a while: their connection is still drawn (idle)
var players = (s.type === 'AUTH' || s.type === 'WORLD') ? Math.max(0, num((s.link || {}).connections) - 1) : 0;
if (any(c) || players > 0) edge('clients', id, c.packets_in, c.bytes_in, c.packets_out, c.bytes_out, true);
var o = rates(split.servers);
// A world's "other servers" is its chat link; chat's are the worlds, drawn from their side
if (s.type === 'WORLD' && any(o)) edge(id, hasChat ? 'chat' : 'master', o.packets_out, o.bytes_out, o.packets_in, o.bytes_in, hasChat, 'packets', hasChat ? '' : 'chat link, chat not reporting');

View File

@@ -178,3 +178,10 @@ console.log('network-graph: all passed');
const starts = Object.keys(W.paths).filter(id => id.includes('master')).map(id => W.paths[id].fwd);
same(new Set(starts.map(d => d.split(' ')[0])).size > 1 || starts.length < 2, true, 'links at master do not all meet at one point');
}
// An idle player (no packets in the window) still has a link from Game clients to their world
{
const idle = G.build({ servers: { w: { key: 'w', type: 'WORLD', zone: 1200, instance: 1, label: 'World 1200', link: { connections: 2 },
split: { clients: {}, master: {}, servers: {} }, packets_in: 0, packets_out: 0, bytes_in: 0, bytes_out: 0 } } }, {});
same(idle.edges.some(e => e.from === 'clients'), true, 'idle player keeps the Game clients link');
}