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

DRAW-375 synchronized -> Redis Lettuce 분산 락 리팩터링 #4

Open
wants to merge 6 commits into
base: feature/DRAW-347
Choose a base branch
from

Conversation

SunwoongH
Copy link
Member

Related Jira ✔

Description ✔

PR Rule ✔

P1: 꼭 반영해주세요 (Request changes)
P2: 적극적으로 고려해주세요 (Request changes)
P3: 웬만하면 반영해 주세요 (Comment)
P4: 반영해도 좋고 넘어가도 좋습니다 (Approve)
P5: 그냥 사소한 의견입니다 (Approve)

@SunwoongH SunwoongH self-assigned this Oct 7, 2024
private fun getLock(key: String): Boolean {
return redisTemplate
.opsForValue()
.setIfAbsent(key + LOCK, LOCK, Duration.ofSeconds(1)) ?: throw NotFoundLockKeyException
Copy link
Contributor

Choose a reason for hiding this comment

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

p4. 락 유지 시간 상수로 처리하시죠.

Comment on lines +4 to +5
fun lock(key: String)
fun unlock(key: String)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fun lock(key: String)
fun unlock(key: String)
fun lock(key: String, call: ()-> Unit)

p3. lock / unlock 구분하지 말고,

lock 에서 람다를 받아서 해당 액션 끝나면 해제 해주는건 어떨까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants