main
Dohyun Lim 2026-03-06 15:29:55 +09:00
parent faeb05537c
commit 97379bebd4
1 changed files with 15 additions and 2 deletions

View File

@ -7,7 +7,7 @@ scheduled_at이 현재 시간 이전이고 status가 pending인 업로드 작업
import asyncio
import logging
from datetime import datetime
from datetime import datetime, timezone
import httpx
from sqlalchemy import text
@ -46,7 +46,20 @@ class SnsUploadJob(BaseJob):
async def _fetch_pending_uploads(self) -> list[int]:
# DB의 다른 datetime 컬럼과 동일하게 Seoul time naive로 비교
now = datetime.now(TIMEZONE).replace(tzinfo=None).strftime("%Y-%m-%d %H:%M:%S")
utc_now = datetime.now(tz=timezone.utc)
server_now = datetime.now()
seoul_aware = datetime.now(TIMEZONE)
now = seoul_aware.replace(tzinfo=None).strftime("%Y-%m-%d %H:%M:%S")
logger.debug(
f"[SNS_UPLOAD][TIME_DEBUG] "
f"서버 UTC: {utc_now.strftime('%Y-%m-%d %H:%M:%S')}, "
f"서버 로컬: {server_now.strftime('%Y-%m-%d %H:%M:%S')}, "
f"Seoul aware: {seoul_aware.isoformat()}, "
f"TIMEZONE={TIMEZONE} (key={TIMEZONE.key}), "
f"now(쿼리용): {now}"
)
query = text("""
SELECT id FROM social_upload
WHERE status = 'pending'