Skip to content

Commit

Permalink
Start metrics server in a goroutine (#4253)
Browse files Browse the repository at this point in the history
* Start metrics server in a goroutine

Signed-off-by: Eduardo Apolinario <[email protected]>

* make lint

Signed-off-by: Eduardo Apolinario <[email protected]>

---------

Signed-off-by: Eduardo Apolinario <[email protected]>
Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Oct 18, 2023
1 parent 481a966 commit 96e3497
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions flytestdlib/profutils/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,14 @@ func StartProfilingServer(ctx context.Context, pprofPort int) error {
Addr: fmt.Sprintf(":%d", pprofPort),
}

e := srv.ListenAndServe()
if e != nil {
logger.Errorf(ctx, "Failed to start profiling server. Error: %v", e)
return fmt.Errorf("failed to start profiling server, %s", e)
}
go func() {
e := srv.ListenAndServe()
if e != nil {
logger.Errorf(ctx, "Failed to start profiling server. Error: %v", e)
}
}()

return nil
return srv.Shutdown(ctx)
}

func configureGlobalHTTPHandler(handlers map[string]http.Handler) error {
Expand Down

0 comments on commit 96e3497

Please sign in to comment.