Implement automated Fleet Hub upstream client package caching and background update distribution
CI Test Suite / Run Component Tests & Pipeline Verification (push) Failing after 1m14s

This commit is contained in:
2026-10-02 23:21:11 +02:00
parent df9f5d191b
commit 8b12186b43
3 changed files with 136 additions and 6 deletions
+21 -2
View File
@@ -2205,6 +2205,22 @@ def health_check():
}
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)
while True:
try:
mgr: ServerUpdateManager = SERVER_STATE.get("update_manager") or UPDATE_MANAGER
mgr.check_upstream_updates(force=False, auto_download_clients=True)
except Exception as e:
print(f"[!] Warning in update checker background loop: {e}")
await asyncio.sleep(interval_hours * 3600)
async def run_server():
"""Runs the mTLS TCP socket listener and the Hermes REST API concurrently."""
config = SERVER_STATE["config"]
@@ -2226,6 +2242,7 @@ async def run_server():
watchdog_task = asyncio.create_task(cert_validity_watchdog())
collector_task = asyncio.create_task(local_collector_loop(interval_seconds=30))
buffer_task = asyncio.create_task(ingest_buffer_worker_loop())
update_task = asyncio.create_task(update_checker_loop(interval_hours=1))
try:
await asyncio.gather(
@@ -2233,13 +2250,15 @@ async def run_server():
uv_server.serve(),
watchdog_task,
collector_task,
buffer_task
buffer_task,
update_task
)
finally:
watchdog_task.cancel()
collector_task.cancel()
buffer_task.cancel()
for t in [watchdog_task, collector_task, buffer_task]:
update_task.cancel()
for t in [watchdog_task, collector_task, buffer_task, update_task]:
try:
await t
except asyncio.CancelledError: