Skip to content

Commit

Permalink
fix(game-server): fixing leaderboard to show proper score
Browse files Browse the repository at this point in the history
After ending the game the leaderboard was out of date because the score function is not awaited
currently. This is caused by how Matter.Engine is structured
  • Loading branch information
rallieon committed Aug 28, 2021
1 parent 482c949 commit 2368a30
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export async function gameGetLeadersListener(
socket: Socket,
leaderboardId: string,
) {
// TODO find a way to make the call to score async/await
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});

const leaders = await haste.game.leaders(new Leaderboard(leaderboardId));
socket.emit('gameGetLeadersCompleted', leaders);
}

0 comments on commit 2368a30

Please sign in to comment.