fix: increase analyze API timeout to 120s for large disk probing
guestfish needs more than 30s to probe a 7.5 GiB VMDK image (mount filesystem, read /etc/os-release, check EFI partition). Other endpoints keep the 30s default.
This commit is contained in:
parent
10199f896b
commit
71792756ea
1 changed files with 8 additions and 7 deletions
|
|
@ -15,6 +15,7 @@ from typing import Optional
|
|||
|
||||
BACKEND_URL = os.getenv("BACKEND_URL", "http://10.2.0.2:9000")
|
||||
TIMEOUT = 30
|
||||
ANALYZE_TIMEOUT = 120 # guestfish needs time to probe large disk images
|
||||
|
||||
|
||||
class ApiError(Exception):
|
||||
|
|
@ -48,7 +49,7 @@ class ApiClient:
|
|||
"vmid": vmid,
|
||||
"source_filename": filename,
|
||||
"source_type": source_type,
|
||||
})
|
||||
}, timeout=ANALYZE_TIMEOUT)
|
||||
|
||||
def create_job(self, payload: dict) -> dict:
|
||||
"""POST /api/v1/jobs — submit conversion job."""
|
||||
|
|
@ -66,16 +67,16 @@ class ApiClient:
|
|||
# Internal
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
def _get(self, path: str) -> dict:
|
||||
return self._request("GET", path)
|
||||
def _get(self, path: str, timeout: int = TIMEOUT) -> dict:
|
||||
return self._request("GET", path, timeout=timeout)
|
||||
|
||||
def _post(self, path: str, data: dict) -> dict:
|
||||
return self._request("POST", path, data)
|
||||
def _post(self, path: str, data: dict, timeout: int = TIMEOUT) -> dict:
|
||||
return self._request("POST", path, data, timeout=timeout)
|
||||
|
||||
def _request(self, method: str, path: str, data: Optional[dict] = None) -> dict:
|
||||
def _request(self, method: str, path: str, data: Optional[dict] = None, timeout: int = TIMEOUT) -> dict:
|
||||
url = urljoin(self.base_url + "/", path.lstrip("/"))
|
||||
try:
|
||||
resp = self._s.request(method, url, json=data, timeout=TIMEOUT)
|
||||
resp = self._s.request(method, url, json=data, timeout=timeout)
|
||||
if resp.ok:
|
||||
return resp.json()
|
||||
detail = resp.text
|
||||
|
|
|
|||
Loading…
Reference in a new issue