fix: await data and system prune

This commit is contained in:
Boris Arzentar 2024-10-01 19:43:17 +02:00
parent 3e88a314d8
commit 279e4792a7

View file

@ -34,13 +34,12 @@ from contextlib import asynccontextmanager
async def lifespan(app: FastAPI):
from cognee.infrastructure.databases.relational import create_db_and_tables
# Not needed if you setup a migration system like Alembic
import asyncio
from cognee.modules.data.deletion import prune_system, prune_data
asyncio.run(prune_data())
asyncio.run(prune_system(metadata = True))
await prune_data()
await prune_system(metadata = True)
# Not needed if you setup a migration system like Alembic
await create_db_and_tables()
yield