From 9ade6b4b0456270ab62c2f79376507e1dfa32660 Mon Sep 17 00:00:00 2001 From: Troy Kelly Date: Sun, 19 Oct 2025 02:55:17 +1100 Subject: [PATCH] Increase timeout for source creation API calls (#152) Changed create_source() timeout from default 30s to 300s (5 minutes) to handle long-running operations like PDF processing with OCR. Issue: - PDF imports were timing out after 30 seconds with "Failed to connect to API: timed out" - PDF processing (especially with OCR/parsing) takes longer than the default timeout - Users were unable to import PDF documents Solution: - Increased timeout to 300 seconds (5 minutes), matching the timeout used by ask_simple() - This gives sufficient time for document processing operations to complete - Prevents premature connection timeout errors Technical Details: - Modified api/client.py create_source() method - Added timeout=300.0 parameter to _make_request() call - Consistent with existing long-running operations (ask_simple uses same timeout) Testing: - Users should now be able to import PDFs without timeout errors - Smaller PDFs will still complete quickly - Larger PDFs have sufficient time to process --- api/client.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/client.py b/api/client.py index 2ab2bd3..d628b25 100644 --- a/api/client.py +++ b/api/client.py @@ -347,7 +347,8 @@ class APIClient: if transformations: data["transformations"] = transformations - return self._make_request("POST", "/api/sources/json", json=data) + # Use 5 minute timeout for source creation (especially PDF processing with OCR) + return self._make_request("POST", "/api/sources/json", json=data, timeout=300.0) def get_source(self, source_id: str) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]: """Get a specific source."""