Skip to content

Commit

Permalink
revert app.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ayulockin committed Sep 6, 2024
1 parent f2bba5a commit 6c0f1ac
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/wandbot/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ async def lifespan(app: FastAPI):

Base.metadata.create_all(bind=engine)

await initialize()

async def backup_db():
"""Periodically backs up the database to a table.
Expand Down Expand Up @@ -144,7 +142,11 @@ async def backup_db():

@app.get("/")
async def root(background_tasks: BackgroundTasks):
return {"message": "Initialization happened in the background"}
logger.info("Received request to root endpoint")
background_tasks.add_task(initialize)
logger.info("Added initialize task to background tasks")
return {"message": "Initialization started in the background"}


app.include_router(chat_router.router)
app.include_router(database_router.router)
Expand Down

0 comments on commit 6c0f1ac

Please sign in to comment.