You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the AI reply scheduling logic to use an event-driven architecture, introducing a new event and listener to decouple the comment and AI comment services. The review feedback suggests simplifying the implementation by removing the redundant postId parameter from the service method and event record, as the post can be accessed directly through the comment entity. Additionally, it is recommended to use more explicit error handling when fetching entities and to utilize JPA relationships to improve efficiency.
The reason will be displayed to describe this comment to others. Learn more.
postId 파라미터는 불필요해 보입니다. aiComment 엔티티가 이미 Post에 대한 참조를 가지고 있으므로 이를 활용할 수 있습니다. 또한, 이벤트 리스너를 통해 전달된 ID로 엔티티를 조회할 때 데이터가 없는 것은 정상적인 상황이 아닐 가능성이 높으므로, 단순히 return 하기보다 orElseThrow를 통해 명시적인 예외를 던져 관측성을 높이는 것이 좋습니다.
publicvoidscheduleReplyForAiComment(LongaiCommentId) {
CommentaiComment = commentRepository.findById(aiCommentId)
.orElseThrow(() -> newNotFoundException("AI 댓글을 찾을 수 없습니다. id=" + aiCommentId));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary