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:
+26
-4
@@ -25,17 +25,28 @@ class _Signals(QObject):
|
||||
class DownloadWorker(QRunnable):
|
||||
"""Clona o actualiza (forzado) y refresca la metadata de un juego."""
|
||||
|
||||
def __init__(self, root: Path, game: Game, token: str = "") -> None:
|
||||
def __init__(
|
||||
self,
|
||||
root: Path,
|
||||
game: Game,
|
||||
token: str = "",
|
||||
net: gitops.NetConfig = gitops.DEFAULT_NET,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.root = root
|
||||
self.game = game
|
||||
self.token = token
|
||||
self.net = net
|
||||
self.signals = _Signals()
|
||||
|
||||
def run(self) -> None: # noqa: D401 - API de QRunnable
|
||||
try:
|
||||
meta: GameMeta = gitops.download(
|
||||
self.root, self.game, log=self.signals.log.emit, token=self.token
|
||||
self.root,
|
||||
self.game,
|
||||
log=self.signals.log.emit,
|
||||
token=self.token,
|
||||
net=self.net,
|
||||
)
|
||||
except Exception as exc: # noqa: BLE001 - reportar a la UI
|
||||
self.signals.error.emit(str(exc))
|
||||
@@ -67,11 +78,18 @@ class CheckUpdatesWorker(QRunnable):
|
||||
Emite `result(game_id, has_update)` por cada juego instalado y `finished` al final.
|
||||
"""
|
||||
|
||||
def __init__(self, root: Path, games: list[Game], token: str = "") -> None:
|
||||
def __init__(
|
||||
self,
|
||||
root: Path,
|
||||
games: list[Game],
|
||||
token: str = "",
|
||||
net: gitops.NetConfig = gitops.DEFAULT_NET,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
self.root = root
|
||||
self.games = games
|
||||
self.token = token
|
||||
self.net = net
|
||||
self.signals = _Signals()
|
||||
|
||||
def run(self) -> None: # noqa: D401 - API de QRunnable
|
||||
@@ -81,7 +99,11 @@ class CheckUpdatesWorker(QRunnable):
|
||||
continue
|
||||
try:
|
||||
has_update = gitops.check_update(
|
||||
self.root, game, log=self.signals.log.emit, token=self.token
|
||||
self.root,
|
||||
game,
|
||||
log=self.signals.log.emit,
|
||||
token=self.token,
|
||||
net=self.net,
|
||||
)
|
||||
except Exception as exc: # noqa: BLE001 - no abortar el resto
|
||||
self.signals.log.emit(f"check {game.id}: {exc}")
|
||||
|
||||
Reference in New Issue
Block a user