feat: implement tunnel quality polling and service monitor tuning to 1s/30s intervals

This commit is contained in:
sagitchu
2026-03-21 17:28:52 +08:00
parent 4417ece7cd
commit 6e3d604618
8 changed files with 156 additions and 30 deletions
@@ -744,6 +744,16 @@ func (h *Handler) monitorServiceLatestResultsHandler(w http.ResponseWriter, r *h
return
}
// Try in-memory cache first (updated every 1s)
if h.healthCheck != nil {
cached := h.healthCheck.GetLatestCached()
if len(cached) > 0 {
response.WriteJSON(w, response.OK(cached))
return
}
}
// Fallback to database
results, err := h.repo.GetLatestServiceMonitorResults()
if err != nil {
response.WriteJSON(w, response.Err(-2, err.Error()))