Skip to content

fix: 회원 한 명의 Slack 사진 동기화를 회원 행 잠금 밖에서 한다 - #153

Merged
ff1451 merged 1 commit into
mainfrom
fix/slack-sync-outside-lock
Oct 18, 2026
Merged

ff1451 merged 1 commit into
mainfrom
fix/slack-sync-outside-lock

Conversation

@ff1451

@ff1451 ff1451 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

요약

POST /v1/admin/members/{id}/photo/slack-sync(MemberDirectoryService.syncProfileImageFromSlack)가 회원 행을 FOR UPDATE로 잠근 트랜잭션 안에서 Slack HTTP 응답을 기다렸다. 그동안(Slack 타임아웃까지 수 초) DB 커넥션을 쥐고, 같은 회원 행을 잠그는 로그인·토큰 갱신이 기다려야 했다. 코드베이스의 다른 외부 호출(메일, 전체 동기화)은 이미 트랜잭션 밖에서 한다.

변경

  • SlackProfileSyncService.syncOne(memberId)로 옮겼다: 잠금 없이 회원을 읽고 → 트랜잭션 밖에서 Slack 이메일 조회 → 저장만 기존 MemberDirectoryService.updatePhotoUrl 트랜잭션(짧은 행 잠금)으로 한다. 전체 동기화 syncAll과 같은 방식이다.
  • 응답({photoUrl})과 에러(회원 없음 404, Slack 프로필 없음)는 그대로다.
  • MemberDirectoryService는 더 이상 SlackClient에 의존하지 않는다.

테스트

  • MemberSlackIdIntegrationTest: Slack 호출 시점에 트랜잭션이 없고(TransactionSynchronizationManager.isActualTransactionActive() == false) 사진이 저장된다.
    • 수정 전 코드에서는 트랜잭션 안에서 호출돼 실패함을 확인했다.
  • 로컬 전체 ./gradlew test: 549건 중 548 통과, 1 스킵.

syncProfileImageFromSlack이 회원 행을 FOR UPDATE로 잠근 트랜잭션 안에서 Slack HTTP를 기다려,
그동안 같은 회원의 로그인·토큰 갱신(같은 행을 잠근다)이 막혔다.

- SlackProfileSyncService.syncOne으로 옮겨, 잠금 없이 회원을 읽고 트랜잭션 밖에서 Slack을 부른 뒤
  저장만 기존 updatePhotoUrl 트랜잭션으로 한다(전체 동기화 syncAll과 같은 방식).
- 응답과 에러는 그대로다.
@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9c44e8e5-0174-438c-9313-7846f334eb1f
📥 Commits

Reviewing files that changed from the base of the PR and between 0690ad0 and 981d253.

📒 Files selected for processing: 4
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/member/controller/AdminMemberController.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/member/service/MemberDirectoryService.java
  • src/main/java/com/bcsdlab/bcsdinternalapiv2/member/service/SlackProfileSyncService.java
  • src/test/java/com/bcsdlab/bcsdinternalapiv2/member/MemberSlackIdIntegrationTest.java
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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

@ff1451
ff1451 merged commit d93822d into main Oct 18, 2026
2 checks passed
@ff1451
ff1451 deleted the fix/slack-sync-outside-lock branch October 18, 2026 13:51
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