fix: set scheduler timezone to KST for correct job execution times

CronTrigger had no explicit timezone, defaulting to system timezone
(UTC in Docker containers), causing jobs to run at KST 03:00/03:30
instead of the intended 18:00/18:30.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
zephyrdark 2026-02-18 21:45:08 +09:00
parent d12bf7b54f
commit fe48e20642

View File

@ -2,9 +2,13 @@
APScheduler configuration for background jobs.
"""
import logging
from zoneinfo import ZoneInfo
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger
KST = ZoneInfo("Asia/Seoul")
from jobs.snapshot_job import create_daily_snapshots
from jobs.collection_job import run_daily_collection
@ -23,12 +27,13 @@ def configure_jobs():
hour=18,
minute=0,
day_of_week='mon-fri',
timezone=KST,
),
id='daily_collection',
name='Collect daily market data',
replace_existing=True,
)
logger.info("Configured daily_collection job at 18:00")
logger.info("Configured daily_collection job at 18:00 KST")
# Daily snapshot at 18:30 (after data collection completes)
scheduler.add_job(
@ -37,12 +42,13 @@ def configure_jobs():
hour=18,
minute=30,
day_of_week='mon-fri',
timezone=KST,
),
id='daily_snapshots',
name='Create daily portfolio snapshots',
replace_existing=True,
)
logger.info("Configured daily_snapshots job at 18:30")
logger.info("Configured daily_snapshots job at 18:30 KST")
def start_scheduler():