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
This commit is contained in:
parent
34a60e515e
commit
9ade6b4b04
1 changed files with 2 additions and 1 deletions
|
|
@ -347,7 +347,8 @@ class APIClient:
|
||||||
if transformations:
|
if transformations:
|
||||||
data["transformations"] = 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]]]:
|
def get_source(self, source_id: str) -> Union[Dict[Any, Any], List[Dict[Any, Any]]]:
|
||||||
"""Get a specific source."""
|
"""Get a specific source."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue