tsweb: add an endpoint to manually trigger a GC.

Signed-off-by: David Anderson <danderson@tailscale.com>
pull/1006/head
David Anderson 3 years ago committed by Dave Anderson
parent 9cb6ee3777
commit 57cd7738c2

@ -44,6 +44,16 @@ func registerCommonDebug(mux *http.ServeMux) {
mux.Handle("/debug/pprof/", Protected(http.DefaultServeMux)) // to net/http/pprof
mux.Handle("/debug/vars", Protected(http.DefaultServeMux)) // to expvar
mux.Handle("/debug/varz", Protected(http.HandlerFunc(varzHandler)))
mux.Handle("/debug/gc", Protected(http.HandlerFunc(gcHandler)))
}
func gcHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("running GC...\n"))
if f, ok := w.(http.Flusher); ok {
f.Flush()
}
runtime.GC()
w.Write([]byte("Done.\n"))
}
func DefaultCertDir(leafDir string) string {

Loading…
Cancel
Save