This commit is contained in:
Maieul BOYER 2026-01-16 17:00:21 +01:00 committed by Nigel
parent c5eea6e29e
commit ef568c9899
2 changed files with 8 additions and 1 deletions

View file

@ -279,6 +279,12 @@ class StateI {
const gameId = newUUID() as unknown as GameId;
this.games.set(gameId, g);
setTimeout(() => {
if (!g.ready_checks[0] && !g.ready_checks[1]) {
this.fastify.log.info(`paused game ${gameId} has been canceled`);
this.cleanupGame(gameId, g);
}
}, 1000 * 31);
this.fastify.log.info('new paused game \'' + gameId + '\'');
return gameId;
}
@ -573,7 +579,7 @@ class StateI {
game.local,
);
this.fastify.log.info('SetGameOutcome !');
if (!game.local) {
if (!game.local && game.ready_checks[0] && game.ready_checks[1]) {
const payload = { nextGame: chat_text };
try {
const resp = await fetch('http://app-chat/broadcastNextGame', {

View file

@ -70,6 +70,7 @@ export class Tournament {
const [u1, u2] = matchup;
const gameId = newUUID() as PongGameId;
const game = State.initGame(null, gameId, u1, u2);
State.broadcastTourStatus(`A Tournament game between ${this.users.get(u1)?.name ?? 'the left player'} and ${this.users.get(u2)?.name ?? 'the right player'} will start ASAP`);
if (game) {
game.onEnd = () => this.gameEnd();
}