Repository navigation
Fix/server timezone - #97
Merged
Merged
Conversation
운영 JVM이 UTC라 생성, 제출 시각이 9시간 이르게 보이고 알림이 의도보다 9시간 늦게 발송되던 문제 수정. 기존 plan 날짜는 운영 기동 시 한 번 자동 보정(백업 plan_backup_20260930), 배포 후 이전 이미지로 롤백 금지
github.io, github.com, notion.site, notion.so, oopy.io, medium.com, brunch.co.kr, blogspot.com, gitbook.io 추가
Member
|
개추드립니다 |
jongcoding
self-requested a review
September 30, 2026 02:34
jongcoding
approved these changes
Sep 30, 2026
Collaborator
Author
|
개추크레용 감사합니다 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hibernate.jdbc.time_zone)는 Asia/Seoul인데 JVM만 UTC여서 생긴 문제다. 과거에 바꾼serverTimezone은 저장값에 영향이 없다는 것을 운영과 같은 MySQL 8.0 조건에서 재현해 확인했다.TimeZones상수로 모으고 JVM 기본값, 스케줄러, 알림 조회 기준을 모두 서울로 고정한다. 기존에 +9시간으로 저장된plan의 시작일과 마감일은 운영 기동 시 한 번 자동 보정한다.Flow
운영에서 앱이 뜨면 다음 순서로 돈다.
LmsApplication.main()이 스프링을 띄우기 전에 JVM 기본 시간대를 Asia/Seoul로 고정한다. 이후LocalDateTime.now(), 생성 시각, 로그 시각이 모두 한국 시각이 된다.PlanDateCorrection이 돈다(prod프로필에서만).data_correction표식이 있으면 건너뛴다.plan을plan_backup_20260930으로 백업한 뒤, 한 트랜잭션에서 표식을 남기고start_date,end_date를 9시간 당긴다.zone = TimeZones.SEOUL로 해석되어 과제 미제출 보고는 매주 월요일 0시, 결석 알림은 매일 오전 9시에 발송된다. 두 알림의 조회 기준 시각도 서울 기준으로 계산한다.과제 제출 시 본문의 URL 호스트가 허용 도메인이거나 그 하위 도메인이면 통과한다. 이름만 비슷한 도메인(
evilgithub.io,github.io.evil.com,github.com@evil.com)은 여전히 거절된다.Changes
config/TimeZones— 서비스 기준 시간대 상수(SEOUL,SEOUL_ZONE)LmsApplication— 스프링 기동 전에 JVM 기본 시간대를 서울로 고정config/PlanDateCorrection— 운영 기동 시 기존plan시작일, 마감일을 한 번만 9시간 당기는 긴급 보정(백업, 표식, 트랜잭션)ScheduledTaskService— 두 cron에zone = TimeZones.SEOUL지정WeeklyAlertService,AttendanceAlertService— 조회 기준now()를 서울 기준으로 계산ValidationUtils— 허용 도메인에 github.io, github.com, notion.site, notion.so, oopy.io, medium.com, brunch.co.kr, blogspot.com, gitbook.io 추가Test
LmsApplicationTimeZoneTest— JVM이 UTC여도 서울로 고정되는지,main()이 스프링 기동 전에 고정하는지ScheduledTaskServiceZoneTest— 두 cron이 서울 기준 월요일 0시, 매일 오전 9시로 해석되는지AlertServiceSeoulClockTest— JVM이 UTC여도 두 알림이 서울 기준으로 조회하는지PlanDateCorrectionTest— 9시간 보정, NULL 유지, 백업, 한 번만 실행,prod외 환경에서 미등록. 다른 계획 행이 있는 DB에서는 건너뛴다ValidationUtilsSubmissionDomainTest— 기존, 추가 도메인 허용과 사칭 도메인 거절prod프로필과 JVM UTC로 두 번 띄워 첫 기동에서 웹 서버보다 먼저 보정되고 두 번째 기동에서 건너뛰는 것을 확인했다.후속
plan_backup_20260930기준으로 복구한다.data_correction표식이 남은 뒤에는PlanDateCorrection을 지워도 된다.