This commit is contained in:
@@ -2,6 +2,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
import shutil
|
||||
import time
|
||||
import uuid
|
||||
from collections.abc import Callable
|
||||
@@ -246,6 +247,27 @@ class RefreshService:
|
||||
total_targets,
|
||||
(overall_timeout_seconds or 0) / 3600,
|
||||
)
|
||||
if targets:
|
||||
remaining_bytes = sum(
|
||||
max(int(details[workshop_id].file_size or 0), 0)
|
||||
for workshop_id in targets
|
||||
if workshop_id in details
|
||||
)
|
||||
workshop_root = self.settings.workshop_content_dir.parent.parent
|
||||
workshop_root.mkdir(parents=True, exist_ok=True)
|
||||
free_bytes = shutil.disk_usage(workshop_root).free
|
||||
required_bytes = int(remaining_bytes * 1.1)
|
||||
logger.info(
|
||||
"Workshop capacity check: %.2f GiB expected, %.2f GiB free",
|
||||
remaining_bytes / (1024**3),
|
||||
free_bytes / (1024**3),
|
||||
)
|
||||
if required_bytes and free_bytes < required_bytes:
|
||||
raise RuntimeError(
|
||||
"Insufficient Workshop volume space: "
|
||||
f"{free_bytes / (1024**3):.2f} GiB free, "
|
||||
f"approximately {required_bytes / (1024**3):.2f} GiB required"
|
||||
)
|
||||
if targets and not self.runner.available():
|
||||
reason = (
|
||||
f"SteamCMD was not found at '{self.settings.steamcmd_path}'. "
|
||||
@@ -305,6 +327,15 @@ class RefreshService:
|
||||
result.elapsed_seconds,
|
||||
result.output_tail or "(no SteamCMD output)",
|
||||
)
|
||||
if result.has_io_failure:
|
||||
recover = getattr(self.runner, "recover_io_failure", None)
|
||||
moved = recover() if callable(recover) else []
|
||||
if moved:
|
||||
logger.warning(
|
||||
"SteamCMD I/O recovery quarantined transient "
|
||||
"Workshop state: %s",
|
||||
", ".join(str(path) for path in moved),
|
||||
)
|
||||
self.database.add_download_attempt(
|
||||
{
|
||||
"run_id": run_id,
|
||||
|
||||
Reference in New Issue
Block a user