Skip to content

Commit

Permalink
fix: event 3:3
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeahxx19 committed Mar 22, 2024
1 parent e7da90a commit eca9e8c
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions src/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(),
);
Expand Down

0 comments on commit eca9e8c

Please sign in to comment.