Skip to content

[FIX] 대기 등록 직후 ACTIVE 전환 시 NPE 수정 - #44

Merged
Jinyoung-Kim96 merged 1 commit into
devfrom
fix/43-npe
May 19, 2026
Merged

Jinyoung-Kim96 merged 1 commit into
devfrom
fix/43-npe

Conversation

@Jinyoung-Kim96

@Jinyoung-Kim96 Jinyoung-Kim96 commented May 19, 2026

Copy link
Copy Markdown
Contributor

📝 작업 내용

이번 PR에서 작업한 내용을 설명해주세요.

  • 대기 등록 직후 스케줄러가 해당 토큰을 ACTIVE 전환하는 redis condition 으로 인한 NPE 수정

🚀 주요 변경 사항

완료한 이슈 번호 #43
Close #43

✅ 자체 체크리스트 (필수)

  • ./gradlew build 실행 결과 정상 (인증샷 첨부)
  • IntelliJ HTTP Client 테스트 완료 (인증샷 첨부)
  • 팀 내 컨벤션 준수 및 불필요한 로그, import 제거
  • 중요한 변경 사항이 팀에 공유되었는지

📸 테스트 인증샷

image

💬 리뷰어 전달사항 (선택)

특별히 봐주었으면 하는 부분이나 논의가 필요한 점을 적어주세요.

  • 논의점


📎 참고 자료

관련 문서, 레퍼런스 링크 등이 있다면 여기에 첨부해주세요.

Summary by CodeRabbit

릴리스 노트

  • 버그 수정
    • 대기열 조회 시 특정 상황에서 발생할 수 있는 오류를 개선하여 대기 정보 조회의 안정성을 향상했습니다.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

대기 등록 직후 Redis 순번 조회가 실패하는 경우를 처리하기 위해 enterWaiting 메서드에 null 분기 로직을 추가했습니다. position이 없으면 데이터베이스에서 엔티티를 재조회하여 위치 정보 없이 결과를 반환합니다.

Changes

Redis 위치 조회 null 분기 처리

Layer / File(s) Summary
Redis 위치 null 조건 분기
src/main/java/com/michelet/waiting/application/service/WaitingService.java
enterWaiting에서 Redis 위치 조회(getPosition) 결과가 null이면 저장된 대기 엔티티를 DB에서 재조회하는 조건 분기를 추가했습니다. 이는 스케줄러가 대기 등록 직후 토큰을 ACTIVE로 전환할 때 position이 아직 준비되지 않은 경합에서 NPE를 방지합니다.

🎯 Review Effort Estimate

🎯 2 (Simple) | ⏱️ ~10 minutes

Related PRs

  • Miche-Let/waiting-service#11: Redis 위치 조회(getPosition())가 ZSET에 항목이 없을 때 null을 반환하도록 구현한 변경과 직접 연계된 버그 수정입니다.
  • Miche-Let/waiting-service#42: enterWaiting 메서드의 Redis 기반 대기 등록 흐름을 수정하는 다른 변경으로, position이 null일 때의 분기 추가와 함께 중복 체크 및 사용자 플래그 처리 로직도 변경합니다.

Suggested Reviewers

  • githyj-jang
  • ji-circle
  • qldo
  • Sehi55

Poem

🐰 Redis가 자리를 잃어도 걱정 말게,
데이터베이스는 항상 우리의 친구네,
null 처리로 NPE는 사라지고,
대기실은 더 안전해졌다네! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Redis에서 조회한 position이 null인 경우를 처리하는 분기 로직이 추가되어 NPE 방지 요구사항을 충족한다.
Out of Scope Changes check ✅ Passed 모든 변경사항이 issue #43의 NPE 수정이라는 목표에 정확히 부합하며, 범위를 벗어난 변경사항이 없다.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed PR 제목이 변경 사항의 핵심을 명확하게 반영하고 있습니다. 대기 등록 직후 ACTIVE 전환 시 발생하는 NPE 문제를 정확하게 설명하고 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/43-npe

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 and usage tips.

@jihxonx jihxonx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다!

@Jinyoung-Kim96 Jinyoung-Kim96 changed the title [FIX]: 대기 등록 직후 ACTIVE 전환 시 NPE 수정 [FIX] 대기 등록 직후 ACTIVE 전환 시 NPE 수정 May 19, 2026
@Jinyoung-Kim96
Jinyoung-Kim96 merged commit c66be87 into dev May 19, 2026
5 checks passed
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.

[BUG] 대기 등록 직후 스케줄러 ACTVIE 전환 시 NPE 수정

2 participants