mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-12 12:05:07 +00:00
fix(api): guard two more Windows errno 13 paths in the serve layer
This commit is contained in:
@@ -1073,13 +1073,19 @@ class DownloadQueueManager:
|
|||||||
log.debug(f"Worker stderr for job {job.job_id}: {safe_stderr}")
|
log.debug(f"Worker stderr for job {job.job_id}: {safe_stderr}")
|
||||||
|
|
||||||
result_data: Optional[Dict[str, Any]] = None
|
result_data: Optional[Dict[str, Any]] = None
|
||||||
try:
|
for attempt in range(5):
|
||||||
with open(result_path, "r", encoding="utf-8") as handle:
|
try:
|
||||||
result_data = json.load(handle)
|
with open(result_path, "r", encoding="utf-8") as handle:
|
||||||
except FileNotFoundError:
|
result_data = json.load(handle)
|
||||||
log.error(f"Result file missing for job {job.job_id}")
|
except FileNotFoundError:
|
||||||
except json.JSONDecodeError as exc:
|
log.error(f"Result file missing for job {job.job_id}")
|
||||||
log.error(f"Failed to parse worker result for job {job.job_id}: {exc}")
|
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:
|
if returncode != 0:
|
||||||
message = result_data.get("message") if result_data else "unknown error"
|
message = result_data.get("message") if result_data else "unknown error"
|
||||||
|
|||||||
@@ -1861,8 +1861,10 @@ def create_service_instance(
|
|||||||
cookies.load(ignore_discard=True, ignore_expires=True)
|
cookies.load(ignore_discard=True, ignore_expires=True)
|
||||||
finally:
|
finally:
|
||||||
import os
|
import os
|
||||||
|
from contextlib import suppress
|
||||||
|
|
||||||
os.unlink(tmp_path)
|
with suppress(OSError):
|
||||||
|
os.unlink(tmp_path)
|
||||||
else:
|
else:
|
||||||
cookies = dl.get_cookie_jar(normalized_service, profile)
|
cookies = dl.get_cookie_jar(normalized_service, profile)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user