Skip to content

Commit

Permalink
check http serve error (#92)
Browse files Browse the repository at this point in the history
Co-authored-by: dbsid <huanshengchen@gmail.com>
  • Loading branch information
sleepymole and dbsid committed Aug 4, 2022
1 parent e9c9632 commit 7f46d6f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/go-tpc/tpcc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ var tpccConfig tpcc.Config
func executeTpcc(action string) {
if pprofAddr != "" {
go func() {
http.ListenAndServe(pprofAddr, http.DefaultServeMux)
if err := http.ListenAndServe(pprofAddr, http.DefaultServeMux); err != nil {
fmt.Printf("Failed to listen pprofAddr: %v\n", err)
os.Exit(1)
}
}()
}
if metricsAddr != "" {
Expand All @@ -30,7 +33,10 @@ func executeTpcc(action string) {
Addr: metricsAddr,
Handler: promhttp.Handler(),
}
s.ListenAndServe()
if err := s.ListenAndServe(); err != nil {
fmt.Printf("Failed to listen metricsAddr: %v\n", err)
os.Exit(1)
}
}()
}
runtime.GOMAXPROCS(maxProcs)
Expand Down

0 comments on commit 7f46d6f

Please sign in to comment.