From 0c85a1a4441ec02032e8960f641f6a090fa96f71 Mon Sep 17 00:00:00 2001 From: Laptop-Limjihoon Date: Sun, 17 Mar 2024 23:02:17 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor=20:=20BuyQueryService=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B9=84=EA=B4=80=EC=A0=81=20=EB=9D=BD=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=9C=20=EC=A1=B0=ED=9A=8C=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=8B=9C,=20retry=20=EB=A7=A4=EC=BB=A4=EB=8B=88=EC=A6=98=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - @Retryable 적용 - delay 100ms 설정 --- .../bc1/gream/domain/buy/service/query/BuyQueryService.java | 3 +++ 1 file changed, 3 insertions(+) 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)); From 2c47aa26d2826c6dc08647bf212b77be7d838560 Mon Sep 17 00:00:00 2001 From: Laptop-Limjihoon Date: Sun, 17 Mar 2024 23:02:56 +0900 Subject: [PATCH 2/2] =?UTF-8?q?refactor=20:=20SellQueryService=20=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=B9=84=EA=B4=80=EC=A0=81=20=EB=9D=BD=20=EC=82=AC?= =?UTF-8?q?=EC=9A=A9=ED=95=9C=20=EC=A1=B0=ED=9A=8C=20=ED=98=B8=EC=B6=9C=20?= =?UTF-8?q?=EC=8B=9C,=20retry=20=EB=A7=A4=EC=BB=A4=EB=8B=88=EC=A6=98=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - @Retryable 적용 - delay 100ms 설정 --- .../gream/domain/sell/service/query/SellQueryService.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)