Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces sorting to battle-related repository queries, implements a custom Socket.IO exception listener to handle non-WebSocket request errors more cleanly, and updates application configurations for task scheduling and Redis timeouts. The review feedback suggests adding a secondary sort key (such as id) to the JPA queries to ensure deterministic ordering when timestamps are identical.
| LEFT JOIN rivals r ON b.fk_rival_id = r.id | ||
| WHERE (r.fk_first_user_id = :userId OR r.fk_second_user_id = :userId) | ||
| AND b.battle_status NOT IN ('REJECTED', 'PENDING', 'CANCELED') | ||
| ORDER BY b.started_at DESC |
There was a problem hiding this comment.
정렬 결과의 일관성(Determinism)을 보장하기 위해 id와 같은 고유한 값을 보조 정렬 키로 추가하는 것이 좋습니다. 특히 페이징 처리가 나중에 추가될 경우, 동일한 started_at 값을 가진 레코드들의 순서가 보장되지 않으면 데이터 누락이나 중복 노출 문제가 발생할 수 있습니다. 또한, Native Query에서 OR 조건과 ORDER BY를 함께 사용하면 데이터량이 많아질 때 성능 저하가 발생할 수 있으므로 관련 컬럼의 인덱스 전략을 확인해 보시기 바랍니다.
| ORDER BY b.started_at DESC | |
| ORDER BY b.started_at DESC, b.id DESC |
| LEFT JOIN rivals r ON b.fk_rival_id = r.id | ||
| WHERE (r.fk_first_user_id = :userId OR r.fk_second_user_id = :userId) | ||
| AND b.battle_status = 'PENDING' | ||
| ORDER BY b.created_at DESC |
변경사항
관련 이슈
Closes #
추가 컨텍스트