Bug bash 5: the URL, the fleet loop, and an empty card

A link to a hub page no longer reloads onto the last machine; a link from a hub-only page to
a machine's page arrives at that page; a page being left no longer asks about the next page's
selection; the hub holds its machines to the rate it is itself running.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Mitchell-Johnson
2026-09-21 23:26:36 -07:00
co-authored by Claude Opus 5
parent a7b8319974
commit 3c7e46104c
9 changed files with 84 additions and 27 deletions
+7 -15
View File
@@ -1986,21 +1986,13 @@ func (s *Server) keepFleetInStep() {
} else {
time.Sleep(2 * time.Minute)
}
var ui struct {
RefreshMs float64 `json:"refreshMs"`
}
var histSec int
s.store.View(func(st *store.State) { _ = json.Unmarshal(st.UI, &ui); histSec = st.HistorySec })
want := map[string][2]any{} // path → {field, value}
if ui.RefreshMs >= 100 {
ms := int(ui.RefreshMs)
if hi := int(metrics.MaxInterval.Milliseconds()); ms > hi {
ms = hi
}
want["/api/prefs/sampler"] = [2]any{"ms", ms}
}
if histSec > 0 {
want["/api/prefs/history"] = [2]any{"seconds", histSec}
// What the hub itself is running is the fleet's answer — not what happens to be written
// in the UI prefs, which are only written when somebody changes a setting. A hub nobody
// has been into Settings on still has a sampling rate and a window, and its machines
// should be on them.
want := map[string][2]any{ // path → {field, value}
"/api/prefs/sampler": {"ms", int(s.metrics.Interval().Milliseconds())},
"/api/prefs/history": {"seconds", int(s.metrics.Window().Seconds())},
}
hdr := http.Header{"X-Hamlab-From-Hub": []string{"1"}, "Content-Type": []string{"application/json"}}
for _, name := range s.nodes.Names() {