Skip to content

Commit 39f3b6b

Browse files
committed
fix: clear stale speedtest_latest from dashboard on server wipe
Add clear_speedtest_latest() to web.py to reset in-memory state. Called when remote server is reachable but has no results.
1 parent 8b2fcff commit 39f3b6b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/modules/speedtest/collector.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def collect(self) -> CollectorResult:
5858
# Remote reachable but empty — server was wiped
5959
log.info("Remote has no results but cache has %d, clearing", cached_count)
6060
self._storage.clear_cache()
61+
self._web.clear_speedtest_latest()
6162
cached_count = 0
6263
elif results and results[0].get("id", 0) < last_id:
6364
log.info(

app/web.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,12 @@ def update_state(analysis=None, error=None, poll_interval=None, connection_info=
657657
_state["weather_latest"] = weather_latest
658658

659659

660+
def clear_speedtest_latest():
661+
"""Clear the cached speedtest_latest from state (e.g. after server reset)."""
662+
with _state_lock:
663+
_state["speedtest_latest"] = None
664+
665+
660666
def get_state() -> dict:
661667
"""Return a snapshot of the shared web state (thread-safe)."""
662668
with _state_lock:

0 commit comments

Comments
 (0)