Skip to content

Commit

Permalink
[fix] 당첨자 저장 자료구조 ZSet으로 통일 및 Default Service 추가 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
win-luck authored and blaxsior committed Aug 6, 2024
1 parent 591e154 commit 406af3f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void registerWinners() {

for(String fcfsId : fcfsIds) {
String eventId = fcfsId.replace(":fcfs", "");
List<String> userIds = stringRedisTemplate.opsForList().range(eventId, 0, -1);
Set<String> userIds = stringRedisTemplate.opsForZSet().range(FcfsUtil.winnerFormatting(eventId), 0, -1);
if(userIds == null || userIds.isEmpty()) {
return;
}
Expand All @@ -73,6 +73,7 @@ public void registerWinners() {
fcfsEventWinningInfoRepository.saveAll(winningInfos);

stringRedisTemplate.delete(FcfsUtil.startTimeFormatting(event.getId().toString()));
stringRedisTemplate.delete(FcfsUtil.winnerFormatting(event.getId().toString()));
numberRedisTemplate.delete(FcfsUtil.keyFormatting(eventId));
booleanRedisTemplate.delete(FcfsUtil.endFlagFormatting(eventId));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.context.annotation.Primary;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
Expand All @@ -17,6 +18,7 @@
@Slf4j
@RequiredArgsConstructor
@Service
@Primary
public class RedisLockFcfsService implements FcfsService {

private final StringRedisTemplate stringRedisTemplate;
Expand Down

0 comments on commit 406af3f

Please sign in to comment.