Timothy J. Baek hace 7 meses
padre
commit
e19406cdd7
Se han modificado 2 ficheros con 5 adiciones y 7 borrados
  1. 0 5
      backend/open_webui/apps/socket/main.py
  2. 5 2
      backend/open_webui/main.py

+ 0 - 5
backend/open_webui/apps/socket/main.py

@@ -90,14 +90,9 @@ async def periodic_usage_pool_cleanup():
         await asyncio.sleep(TIMEOUT_DURATION)
 
 
-async def on_startup():
-    asyncio.create_task(periodic_usage_pool_cleanup())
-
-
 app = socketio.ASGIApp(
     sio,
     socketio_path="/ws/socket.io",
-    on_startup=on_startup(),
 )
 
 

+ 5 - 2
backend/open_webui/main.py

@@ -8,6 +8,8 @@ import shutil
 import sys
 import time
 import uuid
+import asyncio
+
 from contextlib import asynccontextmanager
 from typing import Optional
 
@@ -31,7 +33,7 @@ from open_webui.apps.openai.main import (
 from open_webui.apps.openai.main import get_all_models as get_openai_models
 from open_webui.apps.rag.main import app as rag_app
 from open_webui.apps.rag.utils import get_rag_context, rag_template
-from open_webui.apps.socket.main import app as socket_app
+from open_webui.apps.socket.main import app as socket_app, periodic_usage_pool_cleanup
 from open_webui.apps.socket.main import get_event_call, get_event_emitter
 from open_webui.apps.webui.internal.db import Session
 from open_webui.apps.webui.main import app as webui_app
@@ -184,6 +186,8 @@ https://github.com/open-webui/open-webui
 @asynccontextmanager
 async def lifespan(app: FastAPI):
     run_migrations()
+
+    asyncio.create_task(periodic_usage_pool_cleanup())
     yield
 
 
@@ -851,7 +855,6 @@ async def inspect_websocket(request: Request, call_next):
 
 
 app.mount("/ws", socket_app)
-
 app.mount("/ollama", ollama_app)
 app.mount("/openai", openai_app)