mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
Merge pull request #15490 from sihyeonn/chore/sh-print
refactor: improve logging in task management system
This commit is contained in:
commit
74167f4b48
2 changed files with 9 additions and 2 deletions
|
|
@ -1507,7 +1507,7 @@ async def list_tasks_by_chat_id_endpoint(
|
|||
|
||||
task_ids = await list_task_ids_by_chat_id(request, chat_id)
|
||||
|
||||
print(f"Task IDs for chat {chat_id}: {task_ids}")
|
||||
log.debug(f"Task IDs for chat {chat_id}: {task_ids}")
|
||||
return {"task_ids": task_ids}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,10 +3,17 @@ import asyncio
|
|||
from typing import Dict
|
||||
from uuid import uuid4
|
||||
import json
|
||||
import logging
|
||||
from redis.asyncio import Redis
|
||||
from fastapi import Request
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from open_webui.env import SRC_LOG_LEVELS
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
log.setLevel(SRC_LOG_LEVELS["MAIN"])
|
||||
|
||||
# A dictionary to keep track of active tasks
|
||||
tasks: Dict[str, asyncio.Task] = {}
|
||||
chat_tasks = {}
|
||||
|
|
@ -38,7 +45,7 @@ async def redis_task_command_listener(app):
|
|||
if local_task:
|
||||
local_task.cancel()
|
||||
except Exception as e:
|
||||
print(f"Error handling distributed task command: {e}")
|
||||
log.exception(f"Error handling distributed task command: {e}")
|
||||
|
||||
|
||||
### ------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue