[refactor] : global에서의 의존성을 제거하고, 닉네임 중복 확인 시 분산 락을 활용한다 #87
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에서 작업한 내용을 간략히 설명해주세요(이미지 첨부 가능)
global
패키지 하위에 있는RedisManager
와CookieUtil
이AuthErrorStatus
를 사용하면서 global -> auth로의 의존성이 발생했습니다. 이는 추후 순환 참조 문제 등이 발생할 수 있기에,ErrorStatus
로 코드를 이동시키면서 해결하고자 하였습니다.코드 리뷰에서 언급해 주신 문제 상황 (동시성 문제)를 처리하기 위해서, Redis를 활용한 분산 락을 구현했습니다.
분산 락과 관련된 로직을 하는 클래스입니다.
false
가 반환된 경우에는 중복된 닉네임이라는 에러를 반환합니다.✏️ 관련 이슈
본인이 작업한 내용이 어떤 Issue Number와 관련이 있는지만 작성해주세요
#78
🎸 기타 사항 or 추가 코멘트
지금과 같은 분산락 방법에는 여러 허점들이 존재해서, Redis에서 제공하는
Redlock
이라는 알고리즘을 사용한다고 합니다.이를 구현하고자 했지만 아직 이해도가 낮은 것 같아 추후 학습 후 도입해보려고 합니다!
Redlock 참고 블로그1
Redlock 참고 블로그2