守住 scheduler 早晨排程錯開

This commit is contained in:
OoO
2026-05-13 11:14:10 +08:00
parent b22cbb2aa0
commit 8026b9379b
2 changed files with 10 additions and 0 deletions

View File

@@ -32,6 +32,7 @@
- V2 提到的 `app.py` 死 import 與 `scheduler.py import schedule` 已不成立;`app.py` 仍使用 `schedule.run_pending()` 等呼叫。
- Cron 盲區清單多數已補 `_notify_scheduler_failure()`ROI 月報已避開 09:00 改 09:05AI smoke 已是 09:10。
- V2 指出的 9 個 cron 盲區已補回歸守門8 個 `run_scheduler.py` wrapper 必須呼叫 `_notify_scheduler_failure()``scheduler.py::run_promo_event_task` 必須呼叫 `notify_failure()`
- 09:00 排程衝突已有回歸守門:`daily_report=09:00``roi_monthly_report=09:05``ai_smoke_daily_summary=09:10` 必須保持錯開。
- 0-byte `database/momo*.db` 迷惑檔已不存在;真實 SQLite 僅在 `data/momo_database.db`
- `.gitignore` 已涵蓋 `.claude/worktrees/``.tmp_*``MOMO Pro/`、uploads/screenshots。
- `cache_service.py` 已成為 `cache_manager.py` 的相容 shim`_SALES_CACHE_TTL` 單一來源有測試鎖住。
@@ -89,3 +90,4 @@
- `8a36856` 補強 Telegram callback 診斷
- `5b52af9` 補強 cache best-effort 診斷
- `497c376` 記錄 AI smoke service 入口驗證
- `b22cbb2` 守住 scheduler 失敗告警覆蓋

View File

@@ -139,3 +139,11 @@ def test_v2_cron_blind_spot_list_has_failure_notifications(monkeypatch):
promo_source = _function_source("scheduler.py", "run_promo_event_task")
assert "notify_failure(" in promo_source
def test_roi_ai_smoke_and_daily_report_schedules_stay_staggered():
source = Path("run_scheduler.py").read_text()
assert 'schedule.every().day.at("09:00").do(run_daily_report_task)' in source
assert 'schedule.every().day.at("09:05").do(run_roi_monthly_report_if_new_month)' in source
assert 'schedule.every().day.at("09:10").do(run_ai_smoke_daily_summary_task)' in source