mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
refac/fix: multi-replica tasks
This commit is contained in:
@@ -513,7 +513,7 @@ async def lifespan(app: FastAPI):
|
||||
async_mode=True,
|
||||
)
|
||||
|
||||
if isinstance(app.state.redis, Redis):
|
||||
if app.state.redis is not None:
|
||||
app.state.redis_task_command_listener = asyncio.create_task(
|
||||
redis_task_command_listener(app)
|
||||
)
|
||||
@@ -1424,7 +1424,7 @@ async def stop_task_endpoint(
|
||||
|
||||
@app.get("/api/tasks")
|
||||
async def list_tasks_endpoint(request: Request, user=Depends(get_verified_user)):
|
||||
return {"tasks": list_tasks(request)}
|
||||
return {"tasks": await list_tasks(request)}
|
||||
|
||||
|
||||
@app.get("/api/tasks/chat/{chat_id}")
|
||||
@@ -1435,7 +1435,7 @@ async def list_tasks_by_chat_id_endpoint(
|
||||
if chat is None or chat.user_id != user.id:
|
||||
return {"task_ids": []}
|
||||
|
||||
task_ids = list_task_ids_by_chat_id(request, chat_id)
|
||||
task_ids = await list_task_ids_by_chat_id(request, chat_id)
|
||||
|
||||
print(f"Task IDs for chat {chat_id}: {task_ids}")
|
||||
return {"task_ids": task_ids}
|
||||
|
||||
Reference in New Issue
Block a user