@@ -211,8 +211,15 @@ async function processMatchEvents(
211
211
console . log ( "Match Message Details:" , { user1, user2, roomId, matchId } ) ;
212
212
213
213
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 ) ;
214
218
await redisClient . xAck ( streamKey , consumerGroup , id ) ;
215
219
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 ) ;
216
223
}
217
224
}
218
225
}
@@ -227,10 +234,6 @@ async function handleMatchEvent(user1: any, user2: any, roomId: string, matchId:
227
234
try {
228
235
const io = getSocket ( ) ;
229
236
230
- console . log ( "Before processing messages, message queue state:" ) ;
231
- const messagesBefore = await redisClient . xRange ( 'match_events' , '-' , '+' , { COUNT : 10 } ) ;
232
- console . log ( messagesBefore ) ;
233
-
234
237
const socket1 = io . sockets . sockets . get ( user1 . socketId ) ;
235
238
const socket2 = io . sockets . sockets . get ( user2 . socketId ) ;
236
239
@@ -261,9 +264,6 @@ async function handleMatchEvent(user1: any, user2: any, roomId: string, matchId:
261
264
console . error ( "One or both users are not connected." ) ;
262
265
}
263
266
264
- console . log ( "After processing match event, message queue state:" ) ;
265
- const messagesAfter = await redisClient . xRange ( 'match_events' , '-' , '+' , { COUNT : 10 } ) ;
266
- console . log ( messagesAfter ) ;
267
267
} catch ( error ) {
268
268
console . error ( 'Error in handleMatchEvent:' , error ) ;
269
269
}
0 commit comments