Repository navigation
[FIX] 마지막 타임박스 사회자 이탈 시 종료 알림 발송 및 공유 기록 정리 구조 개선 - #279
Merged
Merged
Conversation
사회자가 마지막 타임박스에서 연결이 끊긴 뒤 재연결 유예 시간이 지나면 기록은 FINISHED로 닫히지만 종료 이벤트를 발행하지 않아 디스코드 알림이 누락됐다. 유예 만료로 종료할 때도 명시적 종료와 같은 종료 이벤트를 발행한다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1분 주기 정리 작업이 진행 중인 공유가 없어도 매번 DB UPDATE를 실행했다. - 1분 주기: 메모리의 진행 중인 공유만 정리하고, 진행 중인 공유가 없으면 바로 끝낸다 - 1시간 주기: 서버 재시작 등으로 추적이 끊긴 12시간 넘은 기록을 중단으로 정리한다 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
서비스 내부 record가 들고 있던 만료·완주 판단을 도메인 객체가 직접 하도록 옮긴다. - ActiveSharing: 진행 순서 기록, 연결 끊김·재연결, 만료 여부, 완주 여부, 종료 시각 판단 - TimerEventType: 이전·다음 이벤트를 이동한 뒤 순서로 바꾸는 규칙 - Instant 대신 LocalDateTime을 써 시간 변환 로직을 없앤다 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
서비스가 JPA 엔티티 대신 SharingLog 도메인으로만 소통하도록 한다. - SharingLogDomainRepository: 엔티티↔도메인 변환, 없는 기록 조회 시 예외, 트랜잭션 경계를 담당 - 종료·중단은 진행 중인 행만 바꾸는 단일 UPDATE로 처리해, 다른 경로에서 먼저 끝난 기록을 덮어쓰지 않고 알림도 보내지 않는다 - SharingLogService, SharingStatsService에서 @transactional 제거 - 종료 이벤트가 트랜잭션 밖에서 발행되므로 리스너에 fallbackExecution을 켠다 - 트랜잭션 밖에서 테이블 소유 회원 정보가 필요한 경우를 위해 CustomizeTableDomainRepository.getWithMemberById 추가 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (22)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Results199 files 199 suites 47s ⏱️ Results for commit 46bae21. |
📝 Test Coverage Report
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🚩 연관 이슈
closed #
배경
SharingLogService가 JPA 엔티티를 직접 다루고, 상태 판단 로직이 서비스 내부 record와 private 메서드에 흩어져 있었다.작업
1. 유예 만료로 종료할 때도 종료 알림 발송 (
[FIX])SharingFinishedEvent를 발행한다.2. 정리 작업 주기 분리
cleanupExpiredRooms에 붙였다.3.
ActiveSharing도메인 분리domain/sharing/ActiveSharing으로 옮긴다. 진행 순서 기록, 연결 끊김·재연결, 만료(isExpired), 완주(isCompleted), 종료 시각(endedAt)을 객체가 직접 판단한다.TimerEventType.toDisplayedSequence로 옮긴다.Instant대신LocalDateTime.now(clock)을 써toLocalDateTime변환을 없앤다.4.
SharingLogDomainRepository도입과 단일 UPDATESharingLog도메인을 추가하고, 서비스(SharingLogService,SharingStatsService)는 도메인으로만 소통한다. 두 서비스의@Transactional은 제거하고 트랜잭션 경계는 DomainRepository가 갖는다.SHARING_LOG_NOT_FOUND)는 DomainRepository에서 처리한다.WHERE id = ? AND status = 'SHARING'조건의 단일 UPDATE로 처리한다. 한 행 단위라 행 잠금으로 동시 종료가 정리되고, 다른 경로(예: 1시간 주기 정리)에서 먼저 끝난 기록은 덮어쓰지 않으며 알림도 보내지 않는다.SharingFinishedListener에fallbackExecution = true를 켰다. 이게 없으면AFTER_COMMIT리스너가 이벤트를 받지 않는다.CustomizeTableDomainRepository.getWithMemberById를 추가했다(@EntityGraph(attributePaths = "member")). 기존getById는 그대로 두고, 트랜잭션 밖에서 회원 정보가 필요한SharingLogService.start만 새 메서드를 쓴다.테스트
ActiveSharingTest,SharingLogTest,SharingLogDomainRepositoryTest,TimerEventTypeTest$ToDisplayedSequence,CustomizeTableDomainRepositoryTest$GetWithMemberByIdSharingLogServiceTest:ApplicationEventPublishermock으로 유예 만료 종료 시 이벤트 발행/미발행, 이미 정리된 기록이면 미발행, 1시간 주기 정리를 검증SharingLogEntityTest는SharingLogTest(도메인)로 옮겼다../gradlew test통과, 커밋마다 관련 테스트 통과 확인🗣️ 리뷰 요구사항 (선택)
🤖 Generated with Claude Code
Summary by CodeRabbit