Skip to content

fix: UTC->KST 변환 추가 - #38

Merged
tkv00 merged 1 commit into
developfrom
fix/#37
Dec 16, 2025
Merged

tkv00 merged 1 commit into
developfrom
fix/#37

Conversation

@tkv00

@tkv00 tkv00 commented Dec 16, 2025

Copy link
Copy Markdown
Contributor

🍀 이슈 번호


✅ 작업 사항

  • batchTime를 외부 변수로 받을 때, UTC 값을 KST로 변환하는 로직을 추가했습니다.

⌨ 기타

@tkv00 tkv00 added the 🐛 fix 기능에 대한 버그 수정 label Dec 16, 2025
@tkv00 tkv00 linked an issue Dec 16, 2025 that may be closed by this pull request
2 tasks
@tkv00 tkv00 changed the title fix/#37: UTC->KST 변환 추가 fix: UTC->KST 변환 추가 Dec 16, 2025
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @tkv00, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 배치 처리 시점의 시간대 문제를 해결하기 위해 UTC 시간을 KST로 정확하게 변환하는 기능을 도입합니다. batchTime이 외부에서 주어지거나 현재 시간을 사용할 때, 모든 배치 작업이 한국 표준시에 맞춰 실행되고 기록되도록 보장하여 시간 관련 데이터의 일관성과 정확성을 향상시킵니다. 또한, 일부 환경 변수 참조가 업데이트되었습니다.

Highlights

  • UTC 시간을 KST로 변환: 외부 변수로 batchTime을 받을 때 UTC 시간을 KST(한국 표준시)로 변환하는 로직이 추가되었습니다. 이는 SlackJudgeBatchRunner에서 CalculateSnapShotDate 유틸리티를 사용하여 처리됩니다.
  • 새로운 시간대 변환 유틸리티: CalculateSnapShotDate 클래스에 UTC와 KST ZoneId 상수가 추가되었고, LocalDateTime을 UTC에서 KST로 변환하는 returnKst 메서드가 구현되었습니다.
  • 환경 변수 참조 업데이트: application.yml에서 Slack 웹훅 URL 환경 변수 참조가 ${SLACK_WEBHOOK_URL}에서 ${SLACK_WEBHOOK_URL:}로 업데이트되었고, mongo.yml에서 MongoDB URI 환경 변수 참조가 ${MONGO_URI}에서 ${MONGO_URL}로 변경되었습니다.
  • 새로운 로그 파일 추가: 테스트 또는 디버깅 목적으로 보이는 batch.log 파일이 새로 추가되었습니다. 이 파일에는 Spring Data, MongoDB 관련 로그 및 배치 작업 실행 세부 정보가 포함되어 있습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

이번 PR은 배치 작업의 시간 처리 시 UTC를 KST로 변환하는 로직을 추가하는 내용이네요. 전반적으로 시간대 변환 로직을 중앙화하려는 시도는 좋아 보입니다. 다만 몇 가지 개선할 점이 보입니다. batch.log 파일이 저장소에 포함되었는데, 이는 .gitignore에 추가하여 관리하는 것이 좋습니다. 또한, LocalDateTime.now() 사용 시 시스템 기본 시간대에 의존하게 되어 잠재적인 버그를 유발할 수 있습니다. 설정된 Clock 빈을 사용하는 것이 더 안정적입니다. 마지막으로, 코드의 가독성과 유지보수성을 높이기 위해 상수는 static final로 선언하고, Javadoc을 표준 형식에 맞게 작성하는 것을 제안합니다.

Comment thread slackjudge/logs/batch.log
}
}
return LocalDateTime.now();
return calculateSnapShotDate.returnKst(LocalDateTime.now());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

LocalDateTime.now()는 시스템의 기본 시간대를 사용하므로, 서버가 예상치 못한 시간대(예: UTC가 아닌 다른 시간대)에서 실행될 경우 잘못된 시간을 반환할 수 있습니다. KST로 설정된 Clock 빈이 있으므로, calculateSnapShotDate.now()를 사용하여 현재 시간을 KST로 안정적으로 가져오는 것이 좋습니다.

Suggested change
return calculateSnapShotDate.returnKst(LocalDateTime.now());
return calculateSnapShotDate.now();

Comment on lines 45 to 47
} catch (Exception e) {
log.warn("Invalid batchTime format: {}, using current time", args[0]);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

포괄적인 Exception 대신 더 구체적인 java.time.format.DateTimeParseException을 catch하는 것이 좋습니다. 이렇게 하면 예외 처리가 더 명확해지고 안정성이 높아집니다.

Suggested change
} catch (Exception e) {
log.warn("Invalid batchTime format: {}, using current time", args[0]);
}
} catch (java.time.format.DateTimeParseException e) {
log.warn("Invalid batchTime format: {}, using current time", args[0]);
}

Comment on lines +19 to +20
private final ZoneId KST=ZoneId.of("Asia/Seoul");
private final ZoneId UTC=ZoneId.of("UTC");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

KSTUTC ZoneId 필드는 상수이므로 static final로 선언해야 합니다. 이는 자바에서 상수를 다루는 표준적인 방식이며, 이 클래스의 인스턴스가 생성될 때마다 새로운 객체가 생성되는 것을 방지합니다.

Suggested change
private final ZoneId KST=ZoneId.of("Asia/Seoul");
private final ZoneId UTC=ZoneId.of("UTC");
private static final ZoneId KST = ZoneId.of("Asia/Seoul");
private static final ZoneId UTC = ZoneId.of("UTC");

Comment on lines +64 to +74
/*==========================
*
*CalculateSnapShotDate
* UTC->KST
* @parm
* @return
* @author kimdoyeon
* @version 1.0.0
* @date 25. 12. 16.
*
==========================**/

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

이 메소드의 Javadoc이 불완전하고 표준 형식을 따르지 않습니다. 코드 가독성과 유지보수성을 높이기 위해 표준 Javadoc 형식에 맞춰 메소드, 파라미터, 반환 값에 대한 설명을 명확히 작성해주세요. 특히, 입력 LocalDateTime이 UTC 시간대라고 가정하는 점을 명시하는 것이 중요합니다.

    /**
     * UTC 시간대의 LocalDateTime을 KST 시간대로 변환합니다.
     * 입력된 LocalDateTime은 UTC 시간대인 것으로 가정합니다.
     *
     * @param utcTime UTC 시간대의 LocalDateTime
     * @return KST 시간대로 변환된 LocalDateTime
     */

@sonarqubecloud

Copy link
Copy Markdown

@tkv00
tkv00 merged commit f2030f8 into develop Dec 16, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 fix 기능에 대한 버그 수정

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: 외부 변수 batchTime UTC 변환

1 participant