2 Commits

Author SHA1 Message Date
matst80
c72b0f54c7 enable profiling
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m53s
2024-11-10 18:45:09 +01:00
matst80
234d1d53f2 less shit 2024-11-10 18:40:53 +01:00

16
main.go
View File

@@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"log" "log"
"net/http" "net/http"
"net/http/pprof"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
@@ -191,10 +192,17 @@ func main() {
syncedServer := NewPoolServer(syncedPool, name) syncedServer := NewPoolServer(syncedPool, name)
mux := http.NewServeMux() mux := http.NewServeMux()
mux.Handle("/api/", http.StripPrefix("/api", syncedServer.Serve())) mux.Handle("/api/", http.StripPrefix("/api", syncedServer.Serve()))
mux.HandleFunc("GET /add/remote/{host}", func(w http.ResponseWriter, r *http.Request) { // only for local
syncedPool.AddRemote(r.PathValue("host")) // mux.HandleFunc("GET /add/remote/{host}", func(w http.ResponseWriter, r *http.Request) {
}) // syncedPool.AddRemote(r.PathValue("host"))
mux.HandleFunc("GET /save", app.HandleSave) // })
// mux.HandleFunc("GET /save", app.HandleSave)
mux.HandleFunc("/debug/pprof/", pprof.Index)
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
mux.Handle("/metrics", promhttp.Handler()) mux.Handle("/metrics", promhttp.Handler())
sigs := make(chan os.Signal, 1) sigs := make(chan os.Signal, 1)