This commit is contained in:
2026-02-07 14:32:33 -08:00
parent af54acda3c
commit c8230cbb42
2 changed files with 44 additions and 9 deletions

View File

@@ -143,7 +143,8 @@ class HydrusNetwork:
try:
with HTTPClient(timeout=self.timeout,
headers=headers,
verify_ssl=False) as client:
verify_ssl=False,
retries=1) as client:
response = None
if spec.file_path is not None:
@@ -206,14 +207,30 @@ class HydrusNetwork:
finally:
_render_progress(final=True)
response = client.request(
spec.method,
url,
content=file_gen(),
headers=headers,
raise_for_status=False,
log_http_errors=False,
)
upload_attempts = 3
last_upload_exc: Exception | None = None
for attempt in range(upload_attempts):
try:
response = client.request(
spec.method,
url,
content=file_gen(),
headers=headers,
raise_for_status=False,
log_http_errors=False,
)
last_upload_exc = None
break
except (httpx.TimeoutException, httpx.RequestError) as exc:
last_upload_exc = exc
logger.warning(
f"{self._log_prefix()} Upload timeout/error on attempt {attempt + 1}/{upload_attempts}: {exc}"
)
if attempt < upload_attempts - 1:
continue
raise
if response is None and last_upload_exc is not None:
raise last_upload_exc
else:
content = None
json_data = None