This commit is contained in:
2025-08-25 19:18:40 +08:00
parent 54f1365d24
commit ddddbfbb7c
3 changed files with 549 additions and 634 deletions

View File

@@ -36,8 +36,8 @@ logger.addHandler(handler)
@asynccontextmanager
async def lifespan(_: FastAPI):
pool = await init_postgres_pool()
app.state.pool = pool
#pool = await init_postgres_pool()
#app.state.pool = pool
asyncio.create_task(train_document_task())
@@ -45,7 +45,8 @@ async def lifespan(_: FastAPI):
yield
finally:
# 应用关闭时销毁连接池
await close_postgres_pool(pool)
#await close_postgres_pool(pool)
pass
app = FastAPI(lifespan=lifespan)