From 4d375cf8744a4c7846cc0bea2f51e3c202b91737 Mon Sep 17 00:00:00 2001 From: Tyler Koenig Date: Sat, 16 May 2026 15:05:28 -0400 Subject: [PATCH] fix: seed status and latency from DB history on startup --- internal/monitor/monitor.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/monitor/monitor.go b/internal/monitor/monitor.go index ddabb74..8e55d48 100644 --- a/internal/monitor/monitor.go +++ b/internal/monitor/monitor.go @@ -193,6 +193,16 @@ func (e *Engine) Start(ctx context.Context) { if s.Type == "push" { s.LastCheck = time.Now() } + if h, ok := e.GetHistory(s.ID); ok && len(h.Statuses) > 0 { + if h.Statuses[len(h.Statuses)-1] { + s.Status = "UP" + } else { + s.Status = "DOWN" + } + if len(h.Latencies) > 0 { + s.Latency = h.Latencies[len(h.Latencies)-1] + } + } e.liveState[s.ID] = s e.addToTokenIndex(s) e.mu.Unlock()