Skip to content

Commit 5a26a30

Browse files
authored
Merge pull request #67 from CS3219-AY2425S1/debug-adjustment
Adjust Debug Logs
2 parents 8981808 + a304a33 commit 5a26a30

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

backend/matching-service/controllers/matchingController.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,15 @@ async function processMatchEvents(
211211
console.log("Match Message Details:", { user1, user2, roomId, matchId });
212212

213213
await handleMatchEvent(user1, user2, roomId, matchId);
214+
215+
console.log("Before processing messages, message queue state:");
216+
const messagesBefore = await redisClient.xRange('match_events', '-', '+', { COUNT: 10 });
217+
console.log(messagesBefore);
214218
await redisClient.xAck(streamKey, consumerGroup, id);
215219
await redisClient.xDel(streamKey, id);
220+
console.log("After processing match event, message queue state:");
221+
const messagesAfter = await redisClient.xRange('match_events', '-', '+', { COUNT: 10 });
222+
console.log(messagesAfter);
216223
}
217224
}
218225
}
@@ -227,10 +234,6 @@ async function handleMatchEvent(user1: any, user2: any, roomId: string, matchId:
227234
try {
228235
const io = getSocket();
229236

230-
console.log("Before processing messages, message queue state:");
231-
const messagesBefore = await redisClient.xRange('match_events', '-', '+', { COUNT: 10 });
232-
console.log(messagesBefore);
233-
234237
const socket1 = io.sockets.sockets.get(user1.socketId);
235238
const socket2 = io.sockets.sockets.get(user2.socketId);
236239

@@ -261,9 +264,6 @@ async function handleMatchEvent(user1: any, user2: any, roomId: string, matchId:
261264
console.error("One or both users are not connected.");
262265
}
263266

264-
console.log("After processing match event, message queue state:");
265-
const messagesAfter = await redisClient.xRange('match_events', '-', '+', { COUNT: 10 });
266-
console.log(messagesAfter);
267267
} catch (error) {
268268
console.error('Error in handleMatchEvent:', error);
269269
}

0 commit comments

Comments
 (0)