From eca9e8cefff6adf5358dcb26a4d3286219a82fa6 Mon Sep 17 00:00:00 2001 From: kyeah Date: Fri, 22 Mar 2024 13:42:39 +0900 Subject: [PATCH] fix: event 3:3 --- src/event/event.service.ts | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/event/event.service.ts b/src/event/event.service.ts index 3b6c9a4..6a852af 100644 --- a/src/event/event.service.ts +++ b/src/event/event.service.ts @@ -153,8 +153,7 @@ export class EventService { return 1; } - // debug 2 -> 1 - if (groupQueue.length < 1) { + if (groupQueue.length < 2) { groupQueue.push(id); await this.cacheManager.set(qName, groupQueue); return 0; @@ -176,19 +175,15 @@ export class EventService { await this.cacheManager.set(oppositeQueueName, oppositeQueue); } - // debug 3 -> 1 - if (oppositeQueue.length >= 1) { - // debug 2 -> 1 - const firstGroupIds = groupQueue.slice(0, 1); + if (oppositeQueue.length >= 3) { + const firstGroupIds = groupQueue.slice(0, 2); firstGroupIds.push(id); - await this.cacheManager.set(qName, groupQueue.slice(1)); + await this.cacheManager.set(qName, groupQueue.slice(2)); - // debug 3 -> 1 - const secondGroupIds = oppositeQueue.slice(0, 1); - await this.cacheManager.set(oppositeQueueName, oppositeQueue.slice(1)); + const secondGroupIds = oppositeQueue.slice(0, 3); + await this.cacheManager.set(oppositeQueueName, oppositeQueue.slice(3)); const groupIds = firstGroupIds.concat(secondGroupIds); - // debug 6 -> 2 - if (groupIds.length !== 2) { + if (groupIds.length !== 6) { throw new Error( '왜인지 모르겠지만 groupIds가 이상함.' + groupIds.toString(), );