Skip to content

Commit

Permalink
fix: 검색 멤버 반환 문제 해결
Browse files Browse the repository at this point in the history
forEach가 await을 대기하지 않아 멤버가 반환되지 않는 문제를
해결하였습니다.
  • Loading branch information
JYKIM317 committed Dec 5, 2024
1 parent 064bf7f commit c56c888
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions applicationServer/src/search/search.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ export class SearchController {

await Promise.all([
(searchResult.lives = await this.searchService.getLiveListWithKeyword(keyword)),
(await this.searchService.getMemberListWithKeyword(keyword)).forEach(async (thisUser) => {
if (await this.redisService.exists(`${REDIS_LIVE_KEY}${thisUser.broadcast_id}`))
searchResult.members.push(thisUser);
this.searchService.getMemberListWithKeyword(keyword).then(async (result) => {
for (const thisUser of result) {
if (!(await this.redisService.exists(`${REDIS_LIVE_KEY}${thisUser.broadcast_id}`)))
searchResult.members.push(thisUser);
}
}),
]);

Expand Down

0 comments on commit c56c888

Please sign in to comment.