diff --git a/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java b/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java index 54883d6a..34e693c0 100644 --- a/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java +++ b/src/main/java/com/book/backend/domain/message/repository/MessageRepository.java @@ -12,6 +12,7 @@ @Repository public interface MessageRepository extends JpaRepository { List findTop200ByOrderByCreatedAtDesc(); + List findTop50ByOrderByCreatedAtDesc(); // 특정 opentalk Id 를 갖는 데이터 조회 (페이지네이션) Page findAllByOpentalk(Opentalk opentalk, Pageable pageable); diff --git a/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java b/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java index 2ee43e2d..bd077160 100644 --- a/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java +++ b/src/main/java/com/book/backend/domain/opentalk/service/OpentalkService.java @@ -49,7 +49,7 @@ public class OpentalkService { /* message 테이블에서 최근 200개 데이터 조회 -> opentalkId 기준으로 count 해서 가장 빈번하게 나오는 top 5 id 반환*/ public List getHotOpentalkIds() { log.trace("OpentalkService > hotOpentalk()"); - List recent200Messages = messageRepository.findTop200ByOrderByCreatedAtDesc(); + List recent200Messages = messageRepository.findTop50ByOrderByCreatedAtDesc(); // (key : opentalk_id, value : 출현빈도) Map opentalkIdCountMap = recent200Messages.stream().collect(