Skip to content

refactor: ReservationNotFoundException 터지는 경우 멱등키 롤백 로직 추가#366

Merged
Jjiggu merged 1 commit intodevelopfrom
fix#365-cancel-bug
Feb 23, 2026
Merged

refactor: ReservationNotFoundException 터지는 경우 멱등키 롤백 로직 추가#366
Jjiggu merged 1 commit intodevelopfrom
fix#365-cancel-bug

Conversation

@Jjiggu
Copy link
Contributor

@Jjiggu Jjiggu commented Feb 23, 2026

작업 요약

  • 웨이팅 삭제 시 ReservationNotFoundException 발생하는 경우 멱등키가 남아 웨이팅 취소가 불가능한 상황 발생
  • 멱등키 롤백 로직 추가

Issue Link

#365

문제점 및 어려움

해결 방안

Reference

Summary by CodeRabbit

릴리스 노트

새로운 기능

  • 대기 취소 작업 중 발생하는 오류에 대한 자동 롤백 기능 추가

버그 수정

  • 대기 취소 프로세스의 오류 처리 강화로 불완전한 작업의 자동 복구 메커니즘 개선

@Jjiggu Jjiggu self-assigned this Feb 23, 2026
@Jjiggu Jjiggu added bug Something isn't working refactor 리팩토링 labels Feb 23, 2026
@Jjiggu Jjiggu merged commit 95e9952 into develop Feb 23, 2026
1 of 2 checks passed
@github-actions github-actions bot requested a review from HyemIin February 23, 2026 04:21
@coderabbitai
Copy link

coderabbitai bot commented Feb 23, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

이 PR은 멱등성 키에 대한 롤백 기능을 추가합니다. Redis 저장소에 삭제 메서드가 추가되고, 롤백 서비스 메서드가 생성되며, 취소 플로우가 실패 시 롤백을 트리거하는 예외 처리로 래핑됩니다.

Changes

Cohort / File(s) Summary
Redis Repository Layer
nowait-app-user-api/src/main/java/com/nowait/applicationuser/waiting/redis/WaitingIdempotencyRepository.java
멱등성 키를 Redis에서 삭제하는 deleteByRegisterKey(String key) 메서드 추가
Service Layer
nowait-app-user-api/src/main/java/com/nowait/applicationuser/waiting/service/IdempotencyService.java
입력값 검증 및 로깅을 포함하여 멱등성 키를 롤백하는 rollbackIdempotencyKey(String idempotentKey) 메서드 추가
Cancellation Logic
nowait-app-user-api/src/main/java/com/nowait/applicationuser/waiting/service/WaitingService.java
취소 로직을 try-catch로 래핑하고 RuntimeException 발생 시 멱등성 키 롤백 수행

Sequence Diagram

sequenceDiagram
    participant Client
    participant WaitingService
    participant IdempotencyService
    participant WaitingRepository
    participant RedisRepo as WaitingIdempotencyRepository
    participant Redis

    Client->>WaitingService: cancelWaiting(request)
    
    rect rgb(200, 150, 255, 0.5)
    Note over WaitingService: Try Block
    WaitingService->>WaitingRepository: lookup & cancel reservation
    WaitingRepository-->>WaitingService: reservation cancelled
    WaitingService->>RedisRepo: remove idempotency key
    RedisRepo->>Redis: delete key
    Redis-->>RedisRepo: acknowledged
    RedisRepo-->>WaitingService: key deleted
    WaitingService->>Client: CancelWaitingResponse
    end

    rect rgb(255, 100, 100, 0.5)
    Note over WaitingService: Catch RuntimeException
    WaitingService->>IdempotencyService: rollbackIdempotencyKey(key)
    IdempotencyService->>RedisRepo: deleteByRegisterKey(key)
    RedisRepo->>Redis: delete key
    Redis-->>RedisRepo: acknowledged
    RedisRepo-->>IdempotencyService: key deleted
    IdempotencyService-->>WaitingService: rollback complete
    WaitingService->>Client: rethrow exception
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • HyemIin
✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix#365-cancel-bug

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

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

Labels

bug Something isn't working refactor 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant