Skip to content

Commit

Permalink
refactor: 당첨자수 조회하는 코드를 redis의 getSize()로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
DrRivaski committed Aug 20, 2024
1 parent 6e05e54 commit fa98c48
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ public int getRankingIfWinner(Integer userId) {
@EventLock(key = "LOCK:DRAW_WINNER_LIST_#{#ranking}")
public boolean isWinner(Integer userId, int ranking, int winnerNum) {
String drawWinnerKey = RedisKeyPrefix.DRAW_WINNER_LIST_PREFIX.getPrefix() + ranking;
Set<Integer> drawWinnerSet = getAllDataAsSet(drawWinnerKey);
Long winnerSetSize = getIntegerSetSize(drawWinnerKey);

// 레디스에서 해당 랭킹에 자리가 있는지 확인
if (drawWinnerSet.size() < winnerNum) {
if (winnerSetSize < winnerNum) {
// 자리가 있다면 당첨 성공. 당첨자 리스트에 추가
setIntegerValueToSet(drawWinnerKey, userId);
return true;
Expand Down

0 comments on commit fa98c48

Please sign in to comment.