Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@ public class AlarmSchedulerService {

// 기존 설정 시각
//@Scheduled(cron = "0 0 13 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "0 5 15 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "0 0 14 * * *", zone = "Asia/Seoul")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

스케줄러의 크론(cron) 표현식을 소스 코드에 하드코딩하면, 테스트 환경이나 운영 환경에 따라 주기를 변경할 때마다 코드를 수정하고 재빌드해야 합니다. 특히 테스트를 위해 임시로 수정한 크론 설정이 실수로 운영 환경에 반영될 위험이 있습니다. Spring의 프로퍼티 플레이스홀더를 사용하여 크론 표현식을 외부 설정 파일(application.yml)로 관리하고, 기본값을 제공하는 방식을 권장합니다.

Suggested change
@Scheduled(cron = "0 0 14 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "${app.scheduler.cron.event:0 0 14 * * *}", zone = "Asia/Seoul")

public void sendEventAlarms() {
regionalAlarmCommandService.dispatchScheduledEventAlarms();
}

// 기존 설정 시각
//@Scheduled(cron = "0 0 10 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "2 5 15 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "1 0 14 * * *", zone = "Asia/Seoul")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

상점 알림 스케줄러의 주기도 외부 설정을 통해 관리하도록 변경하는 것을 권장합니다.

Suggested change
@Scheduled(cron = "1 0 14 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "${app.scheduler.cron.store:1 0 14 * * *}", zone = "Asia/Seoul")

public void sendStoreAlarms() {
regionalAlarmCommandService.dispatchScheduledStoreAlarms();
}

// 기존 설정 시각
//@Scheduled(cron = "0 0 18 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "4 5 15 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "2 0 14 * * *", zone = "Asia/Seoul")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

핫 알림 스케줄러의 주기도 외부 설정을 통해 관리하도록 변경하는 것을 권장합니다.

Suggested change
@Scheduled(cron = "2 0 14 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "${app.scheduler.cron.hot:2 0 14 * * *}", zone = "Asia/Seoul")

public void sendHotAlarms() {
hotAlarmCommandService.dispatchScheduledHotAlarms();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class PinGeoScheduler {
private final PinGeoRedisService pinGeoRedisService;
private final RedisTemplate<String, String> redisTemplate;

@Scheduled(cron = "0 0 5 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "0 25 13 * * *", zone = "Asia/Seoul")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

캐시 재구성 스케줄러의 주기 또한 외부 설정을 통해 관리하는 것이 좋습니다. 환경별로 배치 실행 시간을 다르게 제어하거나, 테스트 시에만 주기를 단축하여 검증하기가 훨씬 수월해집니다.

Suggested change
@Scheduled(cron = "0 25 13 * * *", zone = "Asia/Seoul")
@Scheduled(cron = "${app.scheduler.cron.geo-rebuild:0 25 13 * * *}", zone = "Asia/Seoul")

public void rebuildGeoCache() {
// SET lock:geo:rebuild 1 NX PX 600000 — 원자적 명령으로 레이스 컨디션 없음
Boolean acquired = redisTemplate.opsForValue()
Expand Down
Loading