Skip to content

Commit 46ba864

Browse files
committed
loadSource: shorten wait to 10 mins before failing
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
1 parent 7ed8f13 commit 46ba864

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

context_chat_backend/controller.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,10 @@ def _(sources: list[UploadFile]):
319319
):
320320
return JSONResponse(f'Invaild/missing headers for: {source.filename}', 400)
321321

322-
doc_parse_semaphore.acquire(block=True, timeout=29*60) # ~29 minutes
322+
# wait for 10 minutes before failing the request
323+
semres = doc_parse_semaphore.acquire(block=True, timeout=10*60)
324+
if not semres:
325+
return JSONResponse('Document parser worker limit reached, try again in some time', 503)
323326
added_sources = exec_in_proc(target=embed_sources, args=(vectordb_loader, app.extra['CONFIG'], sources))
324327
doc_parse_semaphore.release()
325328

0 commit comments

Comments
 (0)