mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
fix: tool prompts time out when the user's tab is on another instance (#31620)
With WEBSOCKET_MANAGER=redis and several instances or workers, an instance only subscribed to Redis once a browser tab had connected to it. Until then, when a tool or Function asked the user something (a confirmation or an input dialog) and the user's tab was connected to another instance, the user's reply never reached the tool and it waited until it timed out. Every instance now subscribes at startup, so the reply arrives whichever instance the tab is on.
This commit is contained in:
parent
6d409da9d2
commit
288bf91f73
1 changed files with 4 additions and 0 deletions
|
|
@ -193,6 +193,7 @@ from open_webui.socket.main import (
|
|||
periodic_session_pool_cleanup,
|
||||
periodic_usage_pool_cleanup,
|
||||
redis_event_listener,
|
||||
sio,
|
||||
)
|
||||
from open_webui.socket.main import (
|
||||
app as socket_app,
|
||||
|
|
@ -398,6 +399,9 @@ async def lifespan(app: FastAPI):
|
|||
|
||||
if WEBSOCKET_MANAGER == 'redis':
|
||||
app.state.redis_event_listener = asyncio.create_task(redis_event_listener())
|
||||
# socket.io only starts listening on its first connect; event call answers need it earlier
|
||||
sio.manager_initialized = True
|
||||
sio.manager.initialize()
|
||||
|
||||
app.state.periodic_usage_pool_cleanup = asyncio.create_task(periodic_usage_pool_cleanup())
|
||||
app.state.periodic_session_pool_cleanup = asyncio.create_task(periodic_session_pool_cleanup())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue