From 2ecb35651689825a6e4db1e9a79a808bf192d183 Mon Sep 17 00:00:00 2001 From: max Date: Sat, 3 Oct 2026 21:54:33 +0200 Subject: [PATCH] fix(updates): skip redownloading cached packages and disable background updater in CI --- .gitea/workflows/ci.yml | 1 + src/hub/Server.py | 6 ++++-- src/hub/update_manager.py | 6 ++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index d8c554f..df30aec 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: runs-on: logar env: PYTHONPATH: . + LOGAR_DISABLE_AUTO_UPDATE: "1" steps: - name: Checkout Code uses: actions/checkout@v3 diff --git a/src/hub/Server.py b/src/hub/Server.py index eeaf853..a4f7ac1 100644 --- a/src/hub/Server.py +++ b/src/hub/Server.py @@ -2232,8 +2232,10 @@ async def update_checker_loop(interval_hours: int = 1): Background worker that periodically queries the upstream repository and automatically downloads/caches client binary update packages locally on the Hub. """ - # Brief initial pause after socket startup - await asyncio.sleep(5) + if os.environ.get("LOGAR_DISABLE_AUTO_UPDATE", "").lower() in ("1", "true", "yes"): + return + initial_delay = int(os.environ.get("LOGAR_UPDATE_CHECK_INITIAL_DELAY", "60")) + await asyncio.sleep(initial_delay) while True: try: mgr: ServerUpdateManager = SERVER_STATE.get("update_manager") or UPDATE_MANAGER diff --git a/src/hub/update_manager.py b/src/hub/update_manager.py index ce642ab..936f303 100644 --- a/src/hub/update_manager.py +++ b/src/hub/update_manager.py @@ -327,6 +327,12 @@ class ServerUpdateManager: if not target_os: continue + # Check if matching version is already cached locally + existing_pkg = self.get_hosted_packages().get(target_os) + if existing_pkg and existing_pkg.get("exists") and existing_pkg.get("version") == version: + results[target_os] = True + continue + filename = os.path.basename(asset.get("name") or f"client_{target_os}") temp_file = os.path.join(temp_dir, filename)