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")
|
BACKEND_URL = os.getenv("BACKEND_URL", "http://10.2.0.2:9000")
|
||||||
TIMEOUT = 30
|
TIMEOUT = 30
|
||||||
|
ANALYZE_TIMEOUT = 120 # guestfish needs time to probe large disk images
|
||||||
|
|
||||||
|
|
||||||
class ApiError(Exception):
|
class ApiError(Exception):
|
||||||
|
|
@ -48,7 +49,7 @@ class ApiClient:
|
||||||
"vmid": vmid,
|
"vmid": vmid,
|
||||||
"source_filename": filename,
|
"source_filename": filename,
|
||||||
"source_type": source_type,
|
"source_type": source_type,
|
||||||
})
|
}, timeout=ANALYZE_TIMEOUT)
|
||||||
|
|
||||||
def create_job(self, payload: dict) -> dict:
|
def create_job(self, payload: dict) -> dict:
|
||||||
"""POST /api/v1/jobs — submit conversion job."""
|
"""POST /api/v1/jobs — submit conversion job."""
|
||||||
|
|
@ -66,16 +67,16 @@ class ApiClient:
|
||||||
# Internal
|
# Internal
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
def _get(self, path: str) -> dict:
|
def _get(self, path: str, timeout: int = TIMEOUT) -> dict:
|
||||||
return self._request("GET", path)
|
return self._request("GET", path, timeout=timeout)
|
||||||
|
|
||||||
def _post(self, path: str, data: dict) -> dict:
|
def _post(self, path: str, data: dict, timeout: int = TIMEOUT) -> dict:
|
||||||
return self._request("POST", path, data)
|
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("/"))
|
url = urljoin(self.base_url + "/", path.lstrip("/"))
|
||||||
try:
|
try:
|
||||||
resp = self._s.request(method, url, json=data, timeout=TIMEOUT)
|
resp = self._s.request(method, url, json=data, timeout=timeout)
|
||||||
if resp.ok:
|
if resp.ok:
|
||||||
return resp.json()
|
return resp.json()
|
||||||
detail = resp.text
|
detail = resp.text
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue