Merge pull request #3426 from openfrontio/fix_stuck_lobbies

Fix public lobby timer stuck due to IPC race condition
This commit is contained in:
Josh Harris
2026-03-14 06:10:13 +00:00
committed by GitHub
+9 -4
View File
@@ -135,12 +135,13 @@ export class MasterLobbyService {
for (const type of Object.keys(lobbiesByType) as PublicGameType[]) {
const lobbies = lobbiesByType[type];
if (lobbies.length >= 2) {
continue;
}
// Always ensure the next lobby has a timer, even if we already have 2+
// lobbies. This prevents a race where two lobbies are created before
// either receives a startsAt (IPC round-trip delay), leaving both stuck
// without a countdown.
const nextLobby = lobbies[0];
if (nextLobby && nextLobby.startsAt === undefined) {
// The previous game has started, so we need to set the timer on the next game.
this.sendMessageToWorker({
type: "updateLobby",
gameID: nextLobby.gameID,
@@ -148,6 +149,10 @@ export class MasterLobbyService {
});
}
if (lobbies.length >= 2) {
continue;
}
this.sendMessageToWorker({
type: "createGame",
gameID: generateID(),