Skip to content

Commit

Permalink
Don't race these two events
Browse files Browse the repository at this point in the history
  • Loading branch information
Quantumplation committed Nov 27, 2024
1 parent 7ac3a03 commit b9fff0d
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions referee/referee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,15 @@ hydra.onNewGame = async (newGameId, playerCount, botCount, ephemeralKey) => {
actors.push(keys.publicKeyHashHex);
}
actors.push(ephemeralKey);
await Promise.all([
sendEvent(gameId, {
type: "new_game",
game_id: gameId,
}),
sendEvent(gameId, {
type: "player_joined",
game_id: gameId,
key: ephemeralKey,
}),
]);
await sendEvent(gameId, {
type: "new_game",
game_id: gameId,
});
await sendEvent(gameId, {
type: "player_joined",
game_id: gameId,
key: ephemeralKey,
});
};
hydra.onPlayerJoin = async (gameId, ephemeralKeys) => {
const newPlayer = ephemeralKeys[ephemeralKeys.length - 1];
Expand Down

0 comments on commit b9fff0d

Please sign in to comment.