From 1fdb7edc49e604d25b8cfd404441eec588436a40 Mon Sep 17 00:00:00 2001 From: Lloyd Date: Mon, 9 Mar 2026 11:09:30 +0000 Subject: [PATCH] Allow bypassing cache in update check endpoint with optional force parameter --- repeater/web/update_endpoints.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/repeater/web/update_endpoints.py b/repeater/web/update_endpoints.py index cd7f4a3..b135b1d 100644 --- a/repeater/web/update_endpoints.py +++ b/repeater/web/update_endpoints.py @@ -481,12 +481,20 @@ class UpdateAPIEndpoints: if cherrypy.request.method not in ("POST", "GET"): raise cherrypy.HTTPError(405) - # Honour the cache to avoid hammering GitHub + # Allow caller to bypass cache with {"force": true} + body = {} + try: + body = cherrypy.request.json or {} + except Exception: + pass + force = bool(body.get("force", False)) + + # Honour the cache to avoid hammering GitHub (unless forced) snap = _state.snapshot() if snap["state"] == "checking": return self._ok({"message": "Check already in progress", "state": "checking"}) - if snap["last_checked"] is not None: + if not force and snap["last_checked"] is not None: age = (datetime.utcnow() - _state.last_checked).total_seconds() if age < CHECK_CACHE_TTL and snap["latest_version"] is not None: return self._ok({"message": "Using cached result", "state": snap["state"], **snap})