Feat, Refactor: 스터디룸 입장/퇴장 WebSocket 연동 및 입장 로직 변경. Phase 1 (#96) #116
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.
📌 개요
방 입장과 퇴장에 대한 웹소켓 연동을 구현 한 뒤, 순환 참조 문제를 확인 한 뒤 해당 문제 해결 하다
동시성 문제가 발생 할 수 있음을 발견하여 이를 해결하고자 브로드캐스트(이벤트)는 별도로 분리하는 과정에서
로직에 대해 자세히 짜놓지 않은 상태에서 JWT나 Redis, Websocket과 연동 할 때마다 Test 코드를 갈아엎어야 해서
입/퇴장에 대한 로직을 조금 구체화 하여 진행 하였습니다.
(문서 위치 : api 명세서 내 '스터디룸 진행상황')
https://www.notion.so/27d4873f28dd806b8e82c9efddb77e9f
🔨 작업 내용
RoomMember 내 엔티티 수정 - 실시간 상태 필드 제거
-> JoinedAt, role, lastActiveAt 은 DB로,
-> isOnline, sessionId, currentRoomId는 Redis로 이전 (필드 제거)// api 명세 수정 예정
Repository 계층 Redis 기반 조회로 변경 (실시간 데이터)
-> 기존 DB만 조회했던 데이터들 Redis와 DB 결합으로 변경
Service 계층 - Websocket과 DB 역할 분리
-> WebSocket 연동 로직 개선
-> 온라인 상태에선 Redis만 신뢰하고 DB는 권한에 대한 정보만을 제공하는 형식
수정 후 DTO 내 불필요한 필드 제거
🔗 관련 이슈
Closes #{이슈 번호}
📝 참고 사항
문서 최신화 및 이슈 수정 해놓도록 하겠습니다.
단위테스트는 통과, 통합 테스트는 통과 못한 상황입니다.
✅ 체크리스트