fix(api): guard two more Windows errno 13 paths in the serve layer

This commit is contained in:
imSp4rky
2026-08-21 17:24:55 -06:00
parent 36add10e66
commit 2d005fcc1c
2 changed files with 16 additions and 8 deletions
+13 -7
View File
@@ -1073,13 +1073,19 @@ class DownloadQueueManager:
log.debug(f"Worker stderr for job {job.job_id}: {safe_stderr}")
result_data: Optional[Dict[str, Any]] = None
try:
with open(result_path, "r", encoding="utf-8") as handle:
result_data = json.load(handle)
except FileNotFoundError:
log.error(f"Result file missing for job {job.job_id}")
except json.JSONDecodeError as exc:
log.error(f"Failed to parse worker result for job {job.job_id}: {exc}")
for attempt in range(5):
try:
with open(result_path, "r", encoding="utf-8") as handle:
result_data = json.load(handle)
except FileNotFoundError:
log.error(f"Result file missing for job {job.job_id}")
except PermissionError as exc:
log.debug(f"Result file for job {job.job_id} denied, retrying: {exc}")
await asyncio.sleep(0.02 * (attempt + 1))
continue
except json.JSONDecodeError as exc:
log.error(f"Failed to parse worker result for job {job.job_id}: {exc}")
break
if returncode != 0:
message = result_data.get("message") if result_data else "unknown error"
+3 -1
View File
@@ -1861,8 +1861,10 @@ def create_service_instance(
cookies.load(ignore_discard=True, ignore_expires=True)
finally:
import os
from contextlib import suppress
os.unlink(tmp_path)
with suppress(OSError):
os.unlink(tmp_path)
else:
cookies = dl.get_cookie_jar(normalized_service, profile)