Wait for round two before adding spare lobbies
CI / checks (push) Successful in 7m20s

This commit is contained in:
2026-10-15 20:40:03 -04:00
parent 68616327ec
commit c1758cce25
11 changed files with 298 additions and 7 deletions
+15
View File
@@ -120,6 +120,21 @@ export function planScaling(
)
return result('wait', 'Waiting for fresh occupancy evidence.');
if (occupied + empty < desired) {
// Brief joins do not increase spare demand until their match reaches round two.
// Keep the ordinary desired count for reporting and surplus removal so a
// new match or missing telemetry cannot retire an existing spare.
const established = members.filter(
(m) => m.state === 'occupied' && m.round !== null && m.round >= 2
).length;
const growthTarget = Math.min(
policy.maximum,
Math.max(policy.minimum, established + policy.spares)
);
if (occupied + empty >= growthTarget)
return result(
'wait',
'Waiting for occupied lobbies to reach round 2 before adding a spare.'
);
if (snapshot.reservedNames.length >= policy.maximum)
return result('wait', 'Maximum lobby reservations reached.');
if (!snapshot.keyPool.available)