Skip to content

Commit

Permalink
chore: include a wg while serving conns
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroenrinzema committed Nov 13, 2023
1 parent 413e316 commit 5ab1b13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func (srv *Server) Serve(listener net.Listener) error {
defer srv.logger.Info("closing server")

srv.logger.Info("serving incoming connections", slog.String("addr", listener.Addr().String()))

srv.wg.Add(1)

// NOTE: handle graceful shutdowns
Expand All @@ -112,7 +111,10 @@ func (srv *Server) Serve(listener net.Listener) error {
return err
}

srv.wg.Add(1)

go func() {
defer srv.wg.Done()
ctx := context.Background()
err = srv.serve(ctx, conn)
if err != nil {
Expand Down

0 comments on commit 5ab1b13

Please sign in to comment.