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(), );