Comprovació d'updates a l'inici opcional + timeouts de xarxa configurables

- Opció marcable «Comprova actualitzacions a l'inici» al menú; persisteix a
  settings.json i llança la comprovació diferida en obrir la finestra.
- Tolerància a repos offline/inalcanzables: low-speed abort + techo dur de
  temps a les operacions git de xarxa (fetch/clone), evitant cuelgues.
- Timeouts exposats a settings.json (git_fetch_timeout, git_clone_timeout,
  http_timeout, git_stall_limit, git_stall_time) via NetConfig, propagats
  UI -> workers -> gitops.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-30 08:52:19 +02:00
parent 90b7bb5fb1
commit c51b7b74ed
4 changed files with 185 additions and 31 deletions
+13
View File
@@ -16,6 +16,13 @@ class Settings:
hide_not_downloaded: bool = False
updates_pending: list[str] = field(default_factory=list) # ids con update pendiente
gitea_token: str = "" # token personal de Gitea para repos privados (no se versiona)
check_updates_on_start: bool = False # comprobar updates automáticamente al iniciar
# Tolerancia a repos offline/inalcanzables (segundos, salvo stall_limit en bytes/s).
git_fetch_timeout: int = 60 # techo para fetch / comprobar update
git_clone_timeout: int = 900 # techo para clone (repo grande)
http_timeout: int = 15 # techo para la API de Gitea
git_stall_limit: int = 1000 # bytes/s: por debajo se considera transferencia estancada
git_stall_time: int = 20 # segundos estancado antes de abortar
def settings_path() -> Path:
@@ -34,6 +41,12 @@ def load_settings() -> Settings:
hide_not_downloaded=bool(data.get("hide_not_downloaded", False)),
updates_pending=list(data.get("updates_pending", [])),
gitea_token=str(data.get("gitea_token", "")),
check_updates_on_start=bool(data.get("check_updates_on_start", False)),
git_fetch_timeout=int(data.get("git_fetch_timeout", 60)),
git_clone_timeout=int(data.get("git_clone_timeout", 900)),
http_timeout=int(data.get("http_timeout", 15)),
git_stall_limit=int(data.get("git_stall_limit", 1000)),
git_stall_time=int(data.get("git_stall_time", 20)),
)