diff --git a/src/main/java/bc1/gream/domain/buy/service/query/BuyQueryService.java b/src/main/java/bc1/gream/domain/buy/service/query/BuyQueryService.java index ba08cc34..815cafc6 100644 --- a/src/main/java/bc1/gream/domain/buy/service/query/BuyQueryService.java +++ b/src/main/java/bc1/gream/domain/buy/service/query/BuyQueryService.java @@ -21,6 +21,8 @@ import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.retry.annotation.Backoff; +import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -57,6 +59,7 @@ public Page findAllBuyBidsOf(Product product, Pag * @param price 구매를 원하는 상품 가격 * @return 구매입찰 */ + @Retryable(backoff = @Backoff(delay = 100)) public Buy getRecentBuyBidOf(Long productId, Long price) { return buyRepository.findByProductIdAndPrice(productId, price, LocalDateTime.now()) .orElseThrow(() -> new GlobalException(BUY_BID_NOT_FOUND)); diff --git a/src/main/java/bc1/gream/domain/sell/service/query/SellQueryService.java b/src/main/java/bc1/gream/domain/sell/service/query/SellQueryService.java index 0b20bdfc..a867bd8e 100644 --- a/src/main/java/bc1/gream/domain/sell/service/query/SellQueryService.java +++ b/src/main/java/bc1/gream/domain/sell/service/query/SellQueryService.java @@ -8,15 +8,17 @@ import bc1.gream.domain.sell.repository.SellRepository; import bc1.gream.domain.user.entity.User; import bc1.gream.global.exception.GlobalException; -import java.time.LocalDateTime; import bc1.gream.global.redis.RedisCacheName; import bc1.gream.global.redis.RestPage; +import java.time.LocalDateTime; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; +import org.springframework.retry.annotation.Backoff; +import org.springframework.retry.annotation.Retryable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -50,6 +52,7 @@ public Sell findByIdAndUser(Long sellId, User user) { } @Transactional(readOnly = true) + @Retryable(backoff = @Backoff(delay = 100)) public Sell getRecentSellBidof(Long productId, Long price) { return sellRepository.findByProductIdAndPrice(productId, price, LocalDateTime.now()).orElseThrow( () -> new GlobalException(SELL_BID_PRODUCT_NOT_FOUND)