Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 주문서 만료 시 COMPLETED 여부 확인 & 결제 완료 시 Redis 주문서 정보 삭제 #229

Merged
merged 8 commits into from
Sep 18, 2023

Conversation

hwihwi523
Copy link
Collaborator

@hwihwi523 hwihwi523 commented Sep 17, 2023

♻️ 변경 사항

  1. 주문서 관련 이벤트 리스너 클래스를 삭제하고, ReceiptService에서 바로 구현한다.
  2. 주문서 만료 시 결제완료된 주문서를 만료시키지 않도록 COMPLETED 여부를 확인한다.
  3. 결제 완료 시 비동기 이벤트를 발행하여 Redis에 존재하는 주문서 정보를 삭제한다.

📌 참고 사항

처음에는 주문서 만료 이벤트 발생 시 COMPLETED가 아닌 것만 만료시키자는 생각을 했습니다.
그런데 이미 결제 완료된 주문서까지 매번 만료 이벤트를 발생시킬 필요가 있을까? 하는 생각이 들어서, 결제 완료 이후 Redis에서 주문서 정보를 삭제하는 로직도 추가했습니다.

요약하자면, 일반적인 경우 결제 완료 후 Redis에서 주문서 정보를 삭제합니다.
그러나 { 결제 완료 -> (비동기 이벤트) 주문서 정보 삭제 } 로직 사이에 만료 이벤트가 발생할 수 있기 때문에, 만료 이벤트가 발생했을 경우 COMPLETED 상태가 아닌지 확인하고 해당 주문서를 만료시킵니다.

발행해야 할 이슈

비동기 이벤트 큐 관련 설정 (발행 완료)


🎸 기타

closes #215

@hwihwi523 hwihwi523 added the feature 새로운 기능 추가 label Sep 17, 2023
@hwihwi523 hwihwi523 self-assigned this Sep 17, 2023
@hwihwi523 hwihwi523 changed the title feat: 주문서 만료 시 COMPLETED 여부 확인 & 결제 완료 시 주문서 만료 이벤트 삭제 feat: 주문서 만료 시 COMPLETED 여부 확인 & 결제 완료 시 Redis 주문서 정보 삭제 Sep 17, 2023
Copy link
Collaborator

@worldii worldii left a comment

Choose a reason for hiding this comment

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

"BUNSANLOCKKINGGOD재휘님을 만나 내 인생이 달라졌다..."

분산락 이게 머지? ......

.
.
.
.
.
.
.
....
MERGE !

Copy link
Member

@whatasame whatasame left a comment

Choose a reason for hiding this comment

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

분산 락을 안 써도 동시성을 해결할 수 있는 부분들 코멘트로 남겼습니다!

Copy link
Member

@whatasame whatasame left a comment

Choose a reason for hiding this comment

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

일단 재고 관련 코멘트 빼고 코멘트 달았습니다. 확인해주세요!

worldii
worldii previously approved these changes Sep 18, 2023
Copy link
Collaborator

@worldii worldii left a comment

Choose a reason for hiding this comment

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

와오고심히 생각한게 느껴집니다~~~~

@sonarcloud
Copy link

sonarcloud bot commented Sep 18, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 25 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

Copy link
Member

@whatasame whatasame left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 저는 단순한 UPDATE 정도는 JPQL로 처리해도 이해하기 쉽다고 생각했습니다.

분산 락을 너무 과하게 쓰고 있는 건 아닐까? 하는 노파심에 남긴 코멘트였는데, 다른 분들의 의견도 궁금합니다.

@hwihwi523 hwihwi523 merged commit df226e7 into develop Sep 18, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 추가
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

fix: 주문서 만료 로직 수행 시, 로직 개선
3 participants