feat(performance): automatic sales update every 30 min, 09:00-19:00 KST
A daemon thread started in the web lifespan runs the same update as the [매출 업데이트] button at :00 and :30 from 09:00 to 19:00 (21 runs a day), fetching the last 10 days including today. It runs as a progress job (user "자동 업데이트", trigger 'schedule'), so a user clicking the button meanwhile sees the running job. A slot is skipped when another update is running; overrun slots are not replayed; the slot at server start is not run. Env: PERFORMANCE_AUTO_SYNC (false = off), PERFORMANCE_AUTO_SYNC_DAYS (10), PERFORMANCE_AUTO_SYNC_HOURS (9-19). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -117,10 +117,14 @@ def build_google_oauth() -> OAuth:
|
||||
async def _lifespan(app_: FastAPI): # noqa: ANN201
|
||||
"""앱 시작 시 백그라운드 작업 시작.
|
||||
- 프로젝트 업무 마감 알림(매일 1회, 기본 09시 KST) 스레드.
|
||||
PROJECT_REMINDERS=false 면 안 돈다. 상세는 app/modules/project/reminders.py."""
|
||||
PROJECT_REMINDERS=false 면 안 돈다. 상세는 app/modules/project/reminders.py.
|
||||
- 실적 매출 자동 업데이트(09~19시 정각·30분, 최근 10일) 스레드.
|
||||
PERFORMANCE_AUTO_SYNC=false 면 안 돈다. 상세는 app/modules/performance/auto_sync.py."""
|
||||
from .modules.performance.auto_sync import start_auto_sync_thread # noqa: WPS433
|
||||
from .modules.project.reminders import start_reminder_thread # noqa: WPS433
|
||||
|
||||
start_reminder_thread(getattr(app_.state, "project_store", None))
|
||||
start_auto_sync_thread(app_.state)
|
||||
yield
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user