Skip to content

feat(chat): 채팅방 채팅 메세지 전달 시간지연 디버깅 (#78)#152

Merged
jaehyeok-code merged 1 commit intodevfrom
feat/#78
Aug 25, 2025
Merged

feat(chat): 채팅방 채팅 메세지 전달 시간지연 디버깅 (#78)#152
jaehyeok-code merged 1 commit intodevfrom
feat/#78

Conversation

@jaehyeok-code
Copy link
Contributor

@jaehyeok-code jaehyeok-code commented Aug 25, 2025

Summary by CodeRabbit

  • Refactor
    • 실시간 채팅·알림 전송 경로를 단순화하고 토픽 라우팅을 일원화하여 다중 서버 환경에서 일관성과 안정성을 개선했습니다.
  • Bug Fixes
    • 특정 환경에서 발생하던 중복 메시지 전송 가능성을 줄이고, 채팅방 메시지 수신 신뢰성을 향상했습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 25, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Redis 발행 대상이 채널 유틸에서 원시 문자열로 변경되었고, publishToRoom의 인자가 UUID → String으로 바뀌었습니다. 메시징 컨트롤러는 로컬 STOMP 전송을 주석 처리하고 Redis 발행 대상 문자열을 직접 조립합니다. 알림 컨트롤러/서비스의 Redis 발행 호출은 주석 처리되었습니다. nodeId 접근자 메서드가 추가되었습니다.

Changes

Cohort / File(s) Summary
Redis Publisher API 변경
backendProject/src/main/java/.../chat/bus/ChatRedisPublisher.java
publishToRoom 시그니처를 UUID→String으로 변경; 채널 계산 제거 후 전달받은 문자열 채널에 직접 발행; 내부 식별자 접근자 nodeId() 추가; 페이로드 _src 주입과 예외 처리 방식은 동일.
메시징 컨트롤러 라우팅 변경
backendProject/src/main/java/.../chat/controller/ChatMessagingController.java
로컬 messagingTemplate.convertAndSend 호출을 주석 처리; Redis 발행 시 채널을 "/topic/chat/" + roomId 문자열로 구성하여 publishToRoom(String, Map) 호출로 변경.
알림 경로에서 Redis 발행 비활성화
backendProject/src/main/java/.../chat/controller/ChatNotificationController.java
chatRedisPublisher.publishToRoom(...) 호출을 주석 처리하여 STOMP 브로드캐스트/DB 저장만 수행.
알림 서비스에서 Redis 발행 비활성화
backendProject/src/main/java/.../chat/service/Impl/ChatNotificationServiceImpl.java
chatRedisPublisher.publishToRoom(...) 호출을 주석 처리하고 기존 STOMP 브로드캐스트만 유지.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant C as Client
  participant MC as ChatMessagingController
  participant ST as STOMP Broker
  participant RP as ChatRedisPublisher
  note over MC: 멤버십 검증 및 payload 구성

  C->>MC: sendMessage(roomId, content)
  %% 로컬 브로드캐스트 (변경: 비활성화)
  rect rgba(200,200,200,0.15)
    note right of MC: 기존: convertAndSend("/topic/chat/{roomId}", payload)\n현재: 주석 처리됨
  end

  MC->>RP: publishToRoom("/topic/chat/" + roomId, payload)
  RP->>RP: payload에 _src=nodeId 설정
  RP-->>ST: Redis channel="/topic/chat/{roomId}"로 fan-out

  note over ST: 구독자에게 분배 (다중 노드)
Loading
sequenceDiagram
  autonumber
  participant SYS as System Event
  participant NC as ChatNotificationController / ChatNotificationServiceImpl
  participant ST as STOMP Broker
  participant RP as ChatRedisPublisher

  SYS->>NC: roomAlert / doDispatch
  NC-->>ST: convertAndSend("/topic/chat/{roomId}", payload)
  rect rgba(200,200,200,0.15)
    note over NC,RP: Redis publishToRoom(...) 호출은 주석 처리됨
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • hwichoi0317
  • Kim-Jaehyun0328
  • wjkim9
  • roode1017

Poem

토실토실 깡총깡총, 채널을 담아 쏜다—슝!
UUID는 굿바이, 문자열 길 따라 붕붕.
노드는 살짝 이름표, _src에 톡—표시 중.
로컬 속삭임 멈추고, Redis 바람을 타네.
채팅방 풀잎 위로, 메시지 별빛처럼 웅—✨🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 7050bd1 and 9903665.

📒 Files selected for processing (4)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/bus/ChatRedisPublisher.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatMessagingController.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/controller/ChatNotificationController.java (1 hunks)
  • backendProject/src/main/java/likelion/mlb/backendProject/domain/chat/service/Impl/ChatNotificationServiceImpl.java (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/#78

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant