Skip to content

Commit

Permalink
make pprof and probe optional
Browse files Browse the repository at this point in the history
  • Loading branch information
vintikzzz committed Dec 25, 2024
1 parent 2f518a1 commit f69217d
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,21 @@ func serve(c *cli.Context) (err error) {
return
}

var servers []cs.Servable

// Setting Probe
probe := cs.NewProbe(c)
defer probe.Close()
if probe != nil {
servers = append(servers, probe)
defer probe.Close()
}

// Setting Pprof
pprof := cs.NewPprof(c)
defer pprof.Close()
if pprof != nil {
servers = append(servers, pprof)
defer pprof.Close()
}

var providers []s.StoreProvider

Expand Down Expand Up @@ -107,10 +115,11 @@ func serve(c *cli.Context) (err error) {

// Setting GRPC Server
grpcServer := s.NewGRPCServer(c, server)
servers = append(servers, grpcServer)
defer grpcServer.Close()

// Setting ServeService
serve := cs.NewServe(probe, pprof, grpcServer)
serve := cs.NewServe(servers...)

// And SERVE!
err = serve.Serve()
Expand Down

0 comments on commit f69217d

Please sign in to comment.