Add profiling to scheduler

This commit is contained in:
Andre Medeiros 2022-05-27 13:27:19 -04:00
parent dc9f42de8b
commit eb853710c4

View file

@ -4,6 +4,8 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http"
_ "net/http/pprof"
"strconv" "strconv"
"time" "time"
@ -100,6 +102,9 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
_, _ = s.Every(1).Minute().Do(func() { pruneDevices(ctx, logger, db) }) _, _ = s.Every(1).Minute().Do(func() { pruneDevices(ctx, logger, db) })
s.StartAsync() s.StartAsync()
srv := &http.Server{Addr: ":8080"}
go func() { _ = srv.ListenAndServe() }()
<-ctx.Done() <-ctx.Done()
s.Stop() s.Stop()