Skip to content
Merged

prod #394

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 @@ -11,7 +11,7 @@
import java.time.LocalDate;

@Slf4j
@CronJob(cron = "0 0 8 22 10 ?", name = "examNumberGeneratorJob_20251026")
@CronJob(cron = "0 0 18 22 10 ?", name = "examNumberGeneratorJob_20251026")

Choose a reason for hiding this comment

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

high

크론(cron) 표현식과 작업 이름(name)에 날짜와 관련된 값(22 10, 20251026)이 하드코딩되어 있습니다. 이러한 방식은 다음과 같은 유지보수 문제를 야기합니다.

  • 유연성 부족: 시험 일정이 변경될 경우, 코드를 직접 수정하고 다시 배포해야 합니다.
  • 오류 발생 가능성: ExamNumberGenerationJobRound1과 거의 동일한 코드가 중복되어 있어, 수정 시 한쪽만 변경하여 불일치가 발생할 수 있습니다.

개선 제안:

  1. 설정 외부화: 크론 표현식과 같은 값들은 application.properties 또는 application.yml 파일로 옮겨 관리하는 것이 좋습니다. 이렇게 하면 애플리케이션 재배포 없이 설정을 변경할 수 있습니다.

    # application.properties 예시
    jobs.exam-generation.round2.cron=0 0 18 22 10 ?

    이를 적용하려면 QuartzAutoRegisterConfig에서 프로퍼티 플레이스홀더(${...})를 해석하는 기능이 필요할 수 있습니다.

  2. 코드 중복 제거: ExamNumberGenerationJobRound1ExamNumberGenerationJobRound2를 하나의 범용적인 ExamNumberGenerationJob 클래스로 통합하고, 시험 날짜와 같은 가변적인 정보를 JobDataMap을 통해 전달하도록 리팩토링하는 것을 강력히 권장합니다. 이렇게 하면 새로운 시험 일정이 추가되어도 클래스를 새로 만들 필요 없이 설정만으로 작업을 추가할 수 있습니다.

@DisallowConcurrentExecution
@RequiredArgsConstructor
public class ExamNumberGenerationJobRound2 implements Job {
Expand Down