mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 10:33:33 +00:00
Merge commit from fork
This commit is contained in:
@@ -200,6 +200,10 @@ export async function startWorker() {
|
||||
|
||||
// Pass creatorPersistentID to createGame
|
||||
const game = gm.createGame(id, gc, creatorPersistentID);
|
||||
if (game === null) {
|
||||
log.warn(`cannot create game, id ${id} already exists`);
|
||||
return res.status(409).json({ error: "Game ID already exists" });
|
||||
}
|
||||
|
||||
log.info(
|
||||
`Worker ${workerId}: IP ${ipAnonymize(clientIP)} creating ${game.isPublic() ? GameType.Public : GameType.Private}${gc?.gameMode ? ` ${gc.gameMode}` : ""} game with id ${id}${creatorPersistentID ? `, creator: ${creatorPersistentID.substring(0, 8)}...` : ""}`,
|
||||
@@ -599,12 +603,15 @@ async function startMatchmakingPolling(gm: GameManager) {
|
||||
log.info(`Lobby poll successful:`, data);
|
||||
|
||||
if (data.assignment) {
|
||||
gm.createGame(
|
||||
const game = gm.createGame(
|
||||
gameId,
|
||||
playlist.get1v1Config(),
|
||||
undefined,
|
||||
Date.now() + 7000,
|
||||
);
|
||||
if (game === null) {
|
||||
log.warn(`Failed to create matchmaking game ${gameId}`);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.name === "AbortError") {
|
||||
|
||||
Reference in New Issue
Block a user