-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature/hellozo0 step2 #29
Open
hellozo0
wants to merge
28
commits into
main
Choose a base branch
from
feature/hellozo0_step2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 은행계좌 번호 생성
- 로컬 캐시를 사용하려고 하였으나, 구현이 어려워 Redis를 통해 일일 한도 계산 로직 구현 - 캐시에서 한도 계산 조건에 부합한지 먼저 체크 - Balance를 추후에 수정 - 만약 balance transaction이 실패했을 경우 캐시 값을 rollback할 수 있도록 구현 - *redis lock을 구현한 부분은 추후 Scheduler commit때 설명 예정
- 12시가 되면 10분 동안 redis에 lock을 걸게 만드는 key-value를 생성하고 모든 데이터를 삭제한다 - 실제 일일한도 여부 파악하는 로직에서 lockKey가 reset인지 여부를 먼저 파악한다 - 실제 은행점검시간 존재하는 것에서 아이디어를 가져왔다
- Bank 번호 생성 Util화 - API 응답형태 변경 - Dto의 불필요한 유효성 검사 제거 - 트랜잭션 스크립트 패턴에서 도메인 모델 패턴으로 변경
- 격리레벨을 (100명 동시 이체를 위한 병목 줄이기 위해) Read Commited로 수정 - DB를 redis의 보조 DB로서 사용
- Batch로 DB 트랜잭션 N -> 1로 감소
- 보내는 사람의 계좌에서 돈을 차감하고 스케줄러를 통해 받는사람의 입금을 도와주는 로직으로 구현 - @scheduled + Redis 를 사용해서 순차적으로 처리하는 로직 - [문제점] 순차처리로 인한 송금 딜레이 문제, 비효율적인 작업 처리 - [개선방향] RedisStream이나 메시지큐 학습후 수정 예정
- 3초마다 송금 이력을 조회해서 송금해준다. - 송금실패시, 롤백 ( 보낸 사람에게 돈 보내고, 일일한도와 같은 것들 다 되돌리기) - 롤백을 실패했을 경우 사람이 처리하도록 넘기는 방식으로
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
구현사항
프로그래밍 요구사항
다른 계좌로의 송금
0시 00분 충전 한도 초기화
개선해야할 점
다른 계좌로의 송금
0시 00분 충전 한도 초기화