260715_01_ENH: 스케쥴러에 들어가는 설정들 yml로 이동
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -37,16 +38,22 @@ public class BizLogResultScheduler {
|
||||
private final BizLogRepository bizLogRepository;
|
||||
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")
|
||||
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());
|
||||
|
||||
while (true) {
|
||||
List<TSendEntity> batch = fetchRefreshTargets(sendTyList, window, 1000);
|
||||
List<TSendEntity> batch = fetchRefreshTargets(sendTyList, window, resultSyncBatchSize);
|
||||
if (batch.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ public class EmailResultPollScheduler {
|
||||
|
||||
private final EmailResultPoller emailResultPoller;
|
||||
|
||||
@Scheduled(cron = "0 */5 * * * *")
|
||||
@Scheduled(cron = "${kri.email.result-poll.recover-cron:0 */5 * * * *}")
|
||||
public void enqueueRecoverableEmailResults() {
|
||||
emailResultPoller.enqueueRecoverableEmailResults();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public class SendReservationEmailScheduler {
|
||||
private final SendEmailService sendEmlService;
|
||||
private final SendRepository sendRepository;
|
||||
|
||||
@Scheduled(cron = "0 */5 * * * *")
|
||||
@Scheduled(cron = "${kri.email.reservation-send.cron:0 */5 * * * *}")
|
||||
@Transactional(transactionManager = "transactionManager")
|
||||
public void sendReservationEmail() {
|
||||
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
|
||||
|
||||
@@ -38,12 +38,21 @@ kri:
|
||||
template-id: "11"
|
||||
|
||||
email:
|
||||
reservation-send:
|
||||
cron: "0 */5 * * * *"
|
||||
result-poll:
|
||||
initial-delay-ms: 10000
|
||||
max-attempts: 0
|
||||
max-delay-ms: 30000
|
||||
recover-days: 3
|
||||
recover-page-size: 1000
|
||||
recover-cron: "0 */5 * * * *"
|
||||
|
||||
sms:
|
||||
result-sync:
|
||||
fixed-delay-ms: 60000
|
||||
window-hours: 1
|
||||
batch-size: 1000
|
||||
|
||||
auth:
|
||||
apikey:
|
||||
@@ -86,4 +95,4 @@ kri:
|
||||
redis:
|
||||
enabled: false # RedisQueueHelper 사용 시 true
|
||||
scheduling:
|
||||
enabled: true # @Scheduled 사용 시 true
|
||||
enabled: true # @Scheduled 사용 시 true
|
||||
|
||||
Reference in New Issue
Block a user