refactor(notification): 배치 lock 개선과 Redis SCAN 개선 #282
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.
📝 요약(Summary)
기존 key.intern() 방식의 락 관리는 JVM에서 GC 대상이 아니라 메모리 누수 위험이 있었습니다.
이걸 고정 개수의 stripe 락으로 변경하여 락이 무한정 생성되지 않도록 방지했습니다.
또한, 기존의 Redis 스캔에서 SCAN 방식은 현재 생성된 전체 배치 중에서 만료된 배치를 찾아서 처리하는 방식이었습니다.
이걸 만료 시간을 기준으로 정렬한 뒤 만료된 배치만 따로 처리하는 ZSET 방식으로 변경하여 효율성을 높였습니다.
📸스크린샷 (선택)
💬 공유사항
✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.