Repository navigation
Conversation
added 14 commits
March 27, 2025 17:47
표 내용이 벗어나는 버그 수정
유저 별 Mutex 적용으로 동시 요청 제어
1. ConfigService 의 외부 주입으로 인한 변인을 통제하기 위해서 Stub 으로 대체 2. 동시 요청 2번은 동시성 문제가 발생 하지 않을 수도 있다라고 판단되어서 5번 도잇 요청으로 증가 사킴 3. 동시 요청 테스트가 변경 됨에 따라 시나리오에 맞춰서 검증 형태를 변경함
1. 충전, 사용 로직 내에서 updatedPoint 를 let 으로 선언하였지만 초기화 후 재할당이 없어야 하기에 const 로 수정하였음 2. 충전, 사용 로직 내에서 최종 반환하는 UserPoint 객체를 실제 userDb 에 저장한 객체로 반환하도록 수정하였음 (Mutex 외부에서 return 하기 위해서 let 변수를 사용함)
1. 포인트가 충전 된 상황을 만들고 이를 검증하기 위한 코드에 불필요한 await 키워드와 코드의 통일성을 해치는 요소들이 존재하여 이를 수정함
This file contains hidden or 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
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.
📌 PR 유형
🗒️ PR 설명
개요
1주차 심화 과제 수행
[심화 과제]
변경 사항
심화 과제 요구사항에 따라 동시 요청에 대한 race condition 을 해소하고자 Mutex 를 사용하였고, 통합 테스트를 통해 검증하였습니다.
🧭 의사결정 흐름
동시 요청에 대해서 race condition 을 해소하기 위해 TS 에서 사용할 수 있는 여러 방식들을 조사하였고, 그 중 손쉽게 적용할 수 있는 async-mutex 라이브러리를 이용한 Mutex Lock 방식을 사용하였고, Promise.allSettled() 함수를 이용해서 동시 요청을 여러 개 발생시켰고, 성공하고 실패하는 요청 개수를 확인, 사용자의 최종 잔고를 확인하는 방향으로 검증하였습니다.
🔗 커밋 링크
Chore: async-mutex 라이브러리 설치 반영 : 51c1a14
Chore: 동시성 제어 방식 및 각 적용의 장/단점 조사 정리 : e99e47b
Fix: README.md 수정 : 322aae6
Test: PointService 통합 테스트 (동시 요청 테스트 포함) : 9b2868b
Refactor: 동시 요청 제어를 위한 Mutex 반영 : 806d6a1
Refactor: PointService 통합 테스트 수정 : e5dfe62
Refactor: 포인트 서비스 코드 최적화(Mutex Ver) : 434d80d
Refactor: 포인트 서비스 통합 테스트 코드 최적화 : ed3f4f9
✅ Definition of Done (DoD)
[심화 과제]
🙋♂️ 리뷰 포인트(질문)
🤔 이번주 KPT 회고
Keep
여러 코치님의 멘토링을 청강하면서 나는 미처 생각하지 못한 부분들을 고민한 동기생들의 질문 내용들을 확인하고 그에 대한 답변 듣기
Problem
Git Branch 전략을 생각하지 않고 계속 코드 작성만 하다보니 PR 을 생성하기 위해서 코드를 이리저리 짜맞추는 일이 생겼습니다.
Try
다음 주차부터는 PR 생성에 도움이 될 수 있도록 Feature 별로 브랜치를 파서 코드를 작성하는 방식을 사용해볼 예정이며
조금 더 PR 생성이 편하게 될 것 같은 방향을 찾을 예정입니다.