Commit 8efd6c9d authored by wangteng's avatar wangteng

首页 分析 功能上线

parent 4ece8b72
...@@ -41,9 +41,10 @@ logger.info("DB: %s", engine.url.render_as_string(hide_password=True)) ...@@ -41,9 +41,10 @@ logger.info("DB: %s", engine.url.render_as_string(hide_password=True))
# 2026-09-29:新版 FastAPI 已移除 app.add_event_handler,改用 lifespan 挂调度器启停; # 2026-09-29:新版 FastAPI 已移除 app.add_event_handler,改用 lifespan 挂调度器启停;
# start_scheduler/stop_scheduler 由下方路由 import 绑定到模块全局,lifespan 执行时已就绪 # start_scheduler/stop_scheduler 由下方路由 import 绑定到模块全局,lifespan 执行时已就绪
# 注意:正式服务器是 Python 3.8,asyncio.to_thread 是 3.9+ API —— 用 run_in_executor 兼容
@asynccontextmanager @asynccontextmanager
async def _lifespan(_: FastAPI): async def _lifespan(_: FastAPI):
await asyncio.to_thread(start_scheduler) await asyncio.get_event_loop().run_in_executor(None, start_scheduler)
yield yield
stop_scheduler() stop_scheduler()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment