From d3fc7ea7f1fe98338932dbe2b46f8b6ce79e4bca Mon Sep 17 00:00:00 2001 From: overthestream Date: Sat, 5 Oct 2024 23:00:06 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B9=8C=EB=93=9C=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 1 + src/domain/blurting/blurting.service.ts | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4c07cfb..508822b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "@nestjs/platform-express": "^10.0.0", "@nestjs/platform-socket.io": "^10.4.1", "@nestjs/swagger": "^7.4.0", + "@nestjs/schedule": "^4.0.0", "@nestjs/typeorm": "^10.0.2", "@nestjs/websockets": "^10.4.1", "axios": "^1.5.1", diff --git a/src/domain/blurting/blurting.service.ts b/src/domain/blurting/blurting.service.ts index fd3196d..5939203 100644 --- a/src/domain/blurting/blurting.service.ts +++ b/src/domain/blurting/blurting.service.ts @@ -65,9 +65,11 @@ export class BlurtingService { async checkQuestion(){ // check willprocessedAt and call processPreQuestions - const users = await this.userService.getUsersInGroup(q.group.id); - const questions = await this.blurtingPreQuestionRepository.findQuestionsToProcess(); - questions.forEach(q=>this.processPreQuestions(q.group, q.no, users )); + const questions = await this.blurtingPreQuestionRepository.findQuestionsToProcess(); + + Promise.all(questions.map(async q=>{ + const users = await this.userService.getUsersInGroup(q.group.id); + this.processPreQuestions(q.group, q.no, users.map(user=>user.id) )})); } async processPreQuestions(