INNER CODE UNIT · Python
_periodic_update_check_loop
slive777/OpenAver · web/app.py:91
async def _periodic_update_check_loop() -> None:
"""非桌面版每 24 小時重查一次;啟動當下已由 startup task 查過。"""
if _is_windows_desktop() or _is_mac_desktop():
return
while True:
await asyncio.sleep(86400)
try:
cfg = load_config()
if cfg.get("general", {}).get("auto_check_update", True):
_maybe_notify_update(await check_update())
except Exception:
logger.warning("lifespan: periodic update check failed", exc_info=True)
@asynccontextmanager
async def lifespan(app: FastAPI):
# ── startup ───────────────────────────────────────────────
# 資料根定版必須在 init_db()/任何 request 之前(CD-B2);失敗走固定 stderr + os._exit。