open-webui/backend/open_webui/routers
Classic298 a3ea7bf043
fix(retrieval): offload Loader.load to a worker thread so file uploads stop blocking the event loop (#23705)
Loader.load() dispatches to the underlying langchain document loaders
(PyMuPDF, Unstructured, python-docx, Tika, …) which are all
synchronous and CPU/IO-bound. process_file() awaited it directly on
the event loop, so parsing a non-trivial PDF/DOCX would freeze the
entire FastAPI app for the duration of the parse — which is what users
experience as "the server hangs whenever I upload a file."

Add an `aload()` async wrapper on Loader that runs the sync load on a
worker thread via asyncio.to_thread, and update process_file() to
await it. The sync API is preserved so existing callers that already
run inside run_in_threadpool (e.g. save_docs_to_vector_db) are
unaffected.

https://claude.ai/code/session_01JSr4NZSskEUQvoJnavVXh8

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-14 10:55:46 -05:00
..
analytics.py chore: format 2026-04-12 18:12:59 -05:00
audio.py refac 2026-04-13 16:25:44 -05:00
auths.py refac 2026-04-13 14:08:58 -05:00
automations.py refac 2026-04-13 14:08:58 -05:00
channels.py refac 2026-04-13 14:08:58 -05:00
chats.py refac 2026-04-13 21:29:03 -05:00
configs.py refac 2026-04-13 18:20:46 -05:00
evaluations.py chore: format 2026-04-12 18:12:59 -05:00
files.py refac 2026-04-14 10:55:11 -05:00
folders.py chore: format 2026-04-12 18:12:59 -05:00
functions.py refac 2026-04-13 14:08:58 -05:00
groups.py refac: async db 2026-04-12 14:22:11 -05:00
images.py refac 2026-04-13 14:33:23 -05:00
knowledge.py fix(retrieval): offload sync VECTOR_DB_CLIENT calls in async paths via AsyncVectorDBClient (#23706) 2026-04-14 10:50:18 -05:00
memories.py fix(retrieval): offload sync VECTOR_DB_CLIENT calls in async paths via AsyncVectorDBClient (#23706) 2026-04-14 10:50:18 -05:00
models.py refac: async db 2026-04-12 14:22:11 -05:00
notes.py refac: async db 2026-04-12 14:22:11 -05:00
ollama.py refac 2026-04-13 14:08:58 -05:00
openai.py refac 2026-04-13 14:29:27 -05:00
pipelines.py refac 2026-03-24 04:49:48 -05:00
prompts.py refac 2026-04-13 14:08:58 -05:00
retrieval.py fix(retrieval): offload Loader.load to a worker thread so file uploads stop blocking the event loop (#23705) 2026-04-14 10:55:46 -05:00
scim.py refac: async db 2026-04-12 14:22:11 -05:00
skills.py refac: async db 2026-04-12 14:22:11 -05:00
tasks.py refac 2026-04-13 14:08:58 -05:00
terminals.py refac: async db 2026-04-12 14:22:11 -05:00
tools.py refac 2026-04-13 14:08:58 -05:00
users.py refac 2026-04-12 18:49:34 -05:00
utils.py refac 2026-04-13 14:08:58 -05:00