|
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -22,7 +23,8 @@ public class OrderCancelService {
|
|
|
private final OrderRepo orderRepo;
|
|
private final OrderRepo orderRepo;
|
|
|
private final OrderService orderService;
|
|
private final OrderService orderService;
|
|
|
|
|
|
|
|
- @Scheduled(fixedRate = 30000)
|
|
|
|
|
|
|
+ @Scheduled(fixedRate = 30000, initialDelay = 10000)
|
|
|
|
|
+ @RedisLock(value = "order_batch_cancel", expire = 3, unit = TimeUnit.MINUTES)
|
|
|
public void batchCancel() {
|
|
public void batchCancel() {
|
|
|
List<Order> orders = orderRepo.findByStatusAndCreatedAtBeforeAndDelFalse(OrderStatus.NOT_PAID,
|
|
List<Order> orders = orderRepo.findByStatusAndCreatedAtBeforeAndDelFalse(OrderStatus.NOT_PAID,
|
|
|
LocalDateTime.now().minusSeconds(210));
|
|
LocalDateTime.now().minusSeconds(210));
|