redis part 6, fix test suites

This commit is contained in:
AlecM33
2023-01-21 15:26:50 -05:00
parent 3ab5f2ff53
commit c762f88159
9 changed files with 703 additions and 685 deletions

View File

@@ -22,9 +22,9 @@ router.post('/sockets/broadcast', function (req, res) {
router.get('/games/state', async (req, res) => {
const gamesArray = [];
await timerManager.client.keys('*').then(async (r) => {
Object.values(r).forEach((v) => gamesArray.push(JSON.parse(v)));
});
const keys = await eventManager.client.keys('*');
const values = await eventManager.client.mGet(keys);
values.forEach((v) => gamesArray.push(JSON.parse(v)));
res.status(200).send(gamesArray);
});

View File

@@ -124,7 +124,7 @@ const Events = [
id: EVENT_IDS.END_GAME,
stateChange: async (game, socketArgs, vars) => {
game.status = globals.STATUS.ENDED;
if (vars.timerManager.timerThreads[game.accessCode]) {
if (game.hasTimer && vars.timerManager.timerThreads[game.accessCode]) {
vars.logger.trace('KILLING TIMER PROCESS FOR ENDED GAME ' + game.accessCode);
vars.timerManager.timerThreads[game.accessCode].kill();
}