Skip to content

Commit

Permalink
fix(server/controllers): fix type logs not sending to store before ra…
Browse files Browse the repository at this point in the history
…ce end
  • Loading branch information
supunTE committed Dec 5, 2023
1 parent 83ab827 commit 76c8531
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ export const sendTypeLogController = ({
return;
}

store.dispatch.game.sendTypeLog({
raceId,
playerId,
playerLog: playerLogsToAppPlayerLogs(playerLogs),
});

const typeLogsQueue = getTypeLogsQueue(raceId, context);
typeLogsQueue.addLog(playerLogs, playerId);
logger.debug('Type logs are added to race type-logs-queue.', context);

// If all players have completed the race, raise RaceEnd event.
const isAllPlayersEnded = checkRaceCompleteInstance.isRaceEnded();
const raceEndData: RaceEndModel = {
Expand All @@ -73,16 +83,6 @@ export const sendTypeLogController = ({
// Clearing the server timeout when all race players have completed their races from the client side.
clearTimeout(serverRaceTimeout);
}

store.dispatch.game.sendTypeLog({
raceId,
playerId,
playerLog: playerLogsToAppPlayerLogs(playerLogs),
});

const typeLogsQueue = getTypeLogsQueue(raceId, context);
typeLogsQueue.addLog(playerLogs, playerId);
logger.debug('Type logs are added to race type-logs-queue.', context);
};

pubsub.subscribe(SocketProtocols.SendTypeLog, sendTypeLogController);

0 comments on commit 76c8531

Please sign in to comment.