改为自动周期采集并优化首页导航

This commit is contained in:
Codex
2026-07-08 22:38:09 +08:00
parent 05d98dd576
commit da5e007324
8 changed files with 191 additions and 128 deletions
+5 -1
View File
@@ -17,8 +17,12 @@ from app.core.log_setup import configure_logging # noqa: E402
@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
# The scheduler lives with the web process for the demo deployment profile.
# 测试环境不启动后台采集,避免接口测试触发真实外部请求。
settings = get_settings()
if settings.env == "test":
yield
return
# 调度器随Web进程常驻,负责自动周期性整理情报。
scheduler = build_scheduler(settings)
scheduler.start()
app.state.scheduler = scheduler