Files
open-webui-custom/backend
Classic298 0b5aa6dd60 fix(db): release connection before LLM call in Ollama /api/chat (#20571)
Remove Depends(get_session) from the /api/chat endpoint to prevent database connections from being held during the entire duration of LLM calls (30-60+ seconds for streaming responses).

Previously, the database session was acquired at request start and held until the streaming response completed. Under concurrent load, this exhausted the connection pool, causing QueuePool timeout errors for other database operations.

The fix allows Models.get_model_by_id() and has_access() to manage their own short-lived sessions internally, releasing the connection immediately after the quick authorization checks complete - before the slow external LLM API call begins.
2026-01-11 23:34:23 +04:00
..
2024-02-24 22:35:11 -08:00
2025-09-12 14:09:32 +08:00
2026-01-09 18:10:27 +04:00
2026-01-09 18:10:27 +04:00
2025-06-27 15:46:38 +04:00
2025-10-07 16:20:27 -05:00