From 1836b3b194a999cadcc1f435e4df2fe7033e8b15 Mon Sep 17 00:00:00 2001 From: juno-junho Date: Fri, 1 Dec 2023 18:42:56 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9C=A0=EC=A0=80=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EC=8B=9C=20NPE=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/spaceclub/user/service/AccountDeleteScheduler.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/spaceclub/user/service/AccountDeleteScheduler.java b/src/main/java/com/spaceclub/user/service/AccountDeleteScheduler.java index e93815c3..b9c85ffb 100644 --- a/src/main/java/com/spaceclub/user/service/AccountDeleteScheduler.java +++ b/src/main/java/com/spaceclub/user/service/AccountDeleteScheduler.java @@ -4,6 +4,7 @@ import com.spaceclub.user.domain.User; import com.spaceclub.user.repository.UserRepository; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -11,6 +12,7 @@ import java.time.LocalDateTime; import java.util.List; +@Slf4j @Component @RequiredArgsConstructor public class AccountDeleteScheduler { @@ -26,11 +28,12 @@ public class AccountDeleteScheduler { // @Scheduled(cron = "0 0 0 * * *", zone = "Asia/Seoul") @Scheduled(fixedRate = 1000 * 60) // 테스트 public void deleteInactiveUsers() { + log.warn("deleteInactiveUsers() is called"); // LocalDateTime threeDaysAgoFromNow = LocalDateTime.now().minusDays(GRACE_DAYS_OF_DELETION); LocalDateTime threeDaysAgoFromNow = LocalDateTime.now().minusMinutes(GRACE_DAYS_OF_DELETION); List usersToDelete = userRepository.findAllUserToDelete(threeDaysAgoFromNow).stream() - .map(User::changeStatusToDeleted) .peek(kakaoOauthInfoSender::unlink) + .map(User::changeStatusToDeleted) .toList(); userRepository.saveAll(usersToDelete);