260715_01_ENH: 스케쥴러에 들어가는 설정들 yml로 이동

This commit is contained in:
2026-07-15 08:22:35 +09:00
parent e38a095755
commit 132a8a0367
4 changed files with 22 additions and 6 deletions

View File

@@ -23,6 +23,7 @@ import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -37,16 +38,22 @@ public class BizLogResultScheduler {
private final BizLogRepository bizLogRepository; private final BizLogRepository bizLogRepository;
private final BulkSendRepository bulkSendRepository; private final BulkSendRepository bulkSendRepository;
@Scheduled(fixedDelay = 60 * 1_000) // 나중에 증가시킬 것 @Value("${kri.sms.result-sync.window-hours:1}")
private long resultSyncWindowHours;
@Value("${kri.sms.result-sync.batch-size:1000}")
private int resultSyncBatchSize;
@Scheduled(fixedDelayString = "${kri.sms.result-sync.fixed-delay-ms:60000}") // 나중에 증가시킬 것
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public void syncSmsResults() { public void syncSmsResults() {
TimeWindow window = buildWindow(1L); // hours는 추후 파라미터화 TimeWindow window = buildWindow(resultSyncWindowHours);
List<Short> sendTyList = List.of(SendType.SMS.getCode(), SendType.LMS_MMS.getCode(), SendType.KKO_AT.getCode()); List<Short> sendTyList = List.of(SendType.SMS.getCode(), SendType.LMS_MMS.getCode(), SendType.KKO_AT.getCode());
while (true) { while (true) {
List<TSendEntity> batch = fetchRefreshTargets(sendTyList, window, 1000); List<TSendEntity> batch = fetchRefreshTargets(sendTyList, window, resultSyncBatchSize);
if (batch.isEmpty()) { if (batch.isEmpty()) {
return; return;
} }

View File

@@ -11,7 +11,7 @@ public class EmailResultPollScheduler {
private final EmailResultPoller emailResultPoller; private final EmailResultPoller emailResultPoller;
@Scheduled(cron = "0 */5 * * * *") @Scheduled(cron = "${kri.email.result-poll.recover-cron:0 */5 * * * *}")
public void enqueueRecoverableEmailResults() { public void enqueueRecoverableEmailResults() {
emailResultPoller.enqueueRecoverableEmailResults(); emailResultPoller.enqueueRecoverableEmailResults();
} }

View File

@@ -27,7 +27,7 @@ public class SendReservationEmailScheduler {
private final SendEmailService sendEmlService; private final SendEmailService sendEmlService;
private final SendRepository sendRepository; private final SendRepository sendRepository;
@Scheduled(cron = "0 */5 * * * *") @Scheduled(cron = "${kri.email.reservation-send.cron:0 */5 * * * *}")
@Transactional(transactionManager = "transactionManager") @Transactional(transactionManager = "transactionManager")
public void sendReservationEmail() { public void sendReservationEmail() {
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime(); LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();

View File

@@ -38,12 +38,21 @@ kri:
template-id: "11" template-id: "11"
email: email:
reservation-send:
cron: "0 */5 * * * *"
result-poll: result-poll:
initial-delay-ms: 10000 initial-delay-ms: 10000
max-attempts: 0 max-attempts: 0
max-delay-ms: 30000 max-delay-ms: 30000
recover-days: 3 recover-days: 3
recover-page-size: 1000 recover-page-size: 1000
recover-cron: "0 */5 * * * *"
sms:
result-sync:
fixed-delay-ms: 60000
window-hours: 1
batch-size: 1000
auth: auth:
apikey: apikey:
@@ -86,4 +95,4 @@ kri:
redis: redis:
enabled: false # RedisQueueHelper 사용 시 true enabled: false # RedisQueueHelper 사용 시 true
scheduling: scheduling:
enabled: true # @Scheduled 사용 시 true enabled: true # @Scheduled 사용 시 true