Skip to content

Commit 22cfb3c

Browse files
committed
refac
1 parent 51765b6 commit 22cfb3c

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

backend/open_webui/routers/retrieval.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,12 @@ async def process_file(
16981698

16991699
# External embedding API takes time (5-60s+).
17001700
# Subsequent updates use fresh async sessions.
1701-
result = save_docs_to_vector_db(
1701+
# NOTE: save_docs_to_vector_db is a sync function that
1702+
# calls asyncio.run_coroutine_threadsafe(..., main_loop).result()
1703+
# which blocks the calling thread. We MUST run it in a
1704+
# worker thread to avoid deadlocking the event loop.
1705+
result = await run_in_threadpool(
1706+
save_docs_to_vector_db,
17021707
request,
17031708
docs=docs,
17041709
collection_name=collection_name,

0 commit comments

Comments
 (0)