-
Couldn't load subscription status.
- Fork 28
Feature/hellozo0 step4 #33
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
base: base/hellozo0
Are you sure you want to change the base?
Conversation
- [Settlement] 대기하는 로직이 추가하면서 기존의 엔티티들에서 필요 없는 remainAmount 삭제 - [SettlementMember] 트랜잭션 테이블이 추가되면서 필요 없는 status 삭제 - Transaction 엔티티 추가
- 정산을 위한 송금 요청 (PENDING) - 정산 요청 수락 (코드 미완) - 72시간 초과시 자동 취소 (커서 페이징으로 구현) - 24시간마다 남은 송금 리마인드 알림 (5분마다)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다. 간단하게 의견 남겼습니다. 추가 완성되면 다시 한 번 봐볼게요
| @Query("SELECT sm FROM SettlementMember sm WHERE sm.settlement.id = :settlementId and sm.accountId = :memberAccountId") | ||
| Optional<SettlementMember> findByAccountIdWithXLock(@Param("settlementId") Long settlementId, @Param("memberAccountId") Long memberAccountId); | ||
|
|
||
| Optional<SettlementMember> findBySettlement(long settlementId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
findBySettlementId()로 해야하지 않나요?
| ORDER BY t.pendingDate, t.id | ||
| LIMIT :size | ||
| """) | ||
| List<Transaction> findExpiredTransactionsWithCursor( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인덱스 설정을 어떻게 하시나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * [Step4] (72시간 초과 시 자동 취소) > (환불 + 상태 변경) | ||
| */ | ||
| @Transactional | ||
| public void processExpiredTransactions(List<Transaction> transactions) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
동시에 취소, 수령 요청이 오면 어떻게 되나요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis큐에 송금 & 수령 & 취소 와 관련된 트랜잭션들을 관리하고 있는데 생각을 해보니
지금 상태값을 먼저 바꾸고 레디스에 넣고 있는 형태라 지금의 코드에서는 상태값을 먼저 확인하고 먼저 실행되는 로직으로 redis 큐에 넣는 방식으로 해야할것 같습니다!
지금 다시 보니 레디스랑 transaction 둘다 쓰니 문제가 많은것 같네요
| * [Step4] 돈을 보냈다는 알림 보내는 함수 | ||
| * "송금 요청이 도착했습니다. 72시간 내에 수령해주세요!" | ||
| * */ | ||
| private void sendNotification(long requestAccountId, String title) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
메일을 보내는 함수는 따른 클래스로 빼도 좋을 것 같아요.
| OR (t.pendingDate = :lastPendingDate AND t.id > :lastTransactionId)) | ||
| ORDER BY t.pendingDate, t.id | ||
| LIMIT :size | ||
| """) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 마감 시간으로 부터 24시간이 남은 데이터를 가져오는 쿼리인데 굳이 커서 페이징을 멀티 value로 할 필요가 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
일단은 현재 mailSent를 통해서, 24시간 알림이 안간 데이터가 있다면 다음 시도때 재시도될 수 있게 구현하기 위해서 컬럼을 추가 햇고, 데이터가 많을거라 생각해서 컬럼들이 많아졌습니다!
AND (t.pendingDate > :lastPendingDate OR (t.pendingDate = :lastPendingDate AND t.id > :lastTransactionId))
이 부분은 중복데이터 때문에 추가했는데, <OR (t.pendingDate = :lastPendingDate> 이부분이 필요한 상황이 안 생길거 같아서 삭제해도 될거 같네요..!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
현재 머지 대상 브랜치가 main으로 되어있어요. 고생하셨습니다~
| sendNotification(transaction.getReceiverAccountId(), StringEnum.ALERT_24_MAIL_TITLE.toString()); | ||
| }); | ||
|
|
||
| updateMailSentStatus(transactions); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
알림이 중복으로 갈 것 같아 고민했는데 따로 상태를 추가해서 처리하셨네요👍

구현사항
프로그래밍 요구사항
미완성 부분
개선사항