Add POST /api/admin/reset-latency endpoint

Zeroes block-update latency counters (count, sum, last, wasted work)
in both memory and the kv store. Used by the StartOS reset-latency
action to let operators start fresh after tuning.
This commit is contained in:
satoshi
2026-05-11 02:18:14 +03:00
parent 6acff6280f
commit 72890d900b
2 changed files with 24 additions and 0 deletions
+6
View File
@@ -38,6 +38,7 @@ func (s *Server) Handler() http.Handler {
mux.HandleFunc("GET /api/snapshot", s.snapshot)
mux.HandleFunc("GET /api/ws", s.handleWS)
mux.HandleFunc("GET /api/admin/debug-blocks", s.debugBlocks)
mux.HandleFunc("POST /api/admin/reset-latency", s.resetLatency)
mux.Handle("/", spaHandler(webui.FS()))
return mux
}
@@ -208,3 +209,8 @@ func (s *Server) debugBlocks(w http.ResponseWriter, r *http.Request) {
"db": db,
})
}
func (s *Server) resetLatency(w http.ResponseWriter, _ *http.Request) {
s.Agg.ResetLatency()
writeJSON(w, http.StatusOK, map[string]any{"ok": true})
}