增加前测任务获取前测结果

This commit is contained in:
18610128193
2026-06-25 13:58:31 +08:00
parent 586bce2aeb
commit a382c27dc3
5 changed files with 364 additions and 4 deletions
+5
View File
@@ -76,6 +76,10 @@ async def lifespan(app: FastAPI):
from app.tasks.material_consumption_task import schedule_daily_sync
consumption_schedule_task = asyncio.create_task(schedule_daily_sync())
# 启动前测结果轮询任务(每分钟检查一次)
from app.tasks.pre_test_result_task import poll_pre_test_results
pre_test_poll_task = asyncio.create_task(poll_pre_test_results())
# 启动时立即同步一次未支付订单
asyncio.create_task(asyncio.sleep(5)) # 等待5秒后再同步,让系统完全启动
async def startup_sync():
@@ -103,6 +107,7 @@ async def lifespan(app: FastAPI):
material_consumption_queue.stop()
await consumption_queue_task
consumption_schedule_task.cancel()
pre_test_poll_task.cancel()
expiry_task.cancel()
token_refresh_task.cancel()
await close_database()