改为自动周期采集并优化首页导航
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user