Skip to content

Commit

Permalink
refactor(hotdeal) : addQueue 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
zomeong committed Feb 8, 2024
1 parent 35006a8 commit d63f7ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/sportsecho/common/redis/RedisUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ public boolean isInWaitQueue(String queueName, String memberEmail) {
}

// hotdeal v3
public void addQueue(Hotdeal hotdeal, Member user, PurchaseHotdealRequestDto requestDto) {
public void addQueue(Long hotdeal, Member user, PurchaseHotdealRequestDto requestDto) {
final String member = String.valueOf(user.getId());
String hotdealId = String.valueOf(hotdeal.getId());
String hotdealId = String.valueOf(hotdeal);

HashOperations<String, String, Object> hashOperations = hotdealRedisTemplate.opsForHash();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,7 @@ public HotdealResponseDto updateHotdeal(Long hotdealId,
public void purchaseHotdealV3(Member member, PurchaseHotdealRequestDto requestDto) {

Long hotdealId = requestDto.getHotdealId();

Hotdeal hotdeal = hotdealRepository.findByIdWithPessimisticWriteLock(hotdealId)
.orElseThrow(() -> new GlobalException(HotdealErrorCode.NOT_FOUND_HOTDEAL));

redisUtil.addQueue(hotdeal, member, requestDto);
redisUtil.addQueue(hotdealId, member, requestDto);
}

@Override
Expand Down

0 comments on commit d63f7ea

Please sign in to comment.