Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Signed-off-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
yurishkuro authored Dec 12, 2024
1 parent d44e04a commit 0f0d231
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions cmd/internal/flags/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,6 @@ func (s *AdminServer) Serve() error {
s.logger.Error("Admin server failed to listen", zap.Error(err))
return err
}
if err = s.serveWithListener(l); err != nil {
return err
}

s.logger.Info(
"Admin server started",
Expand Down Expand Up @@ -138,17 +135,15 @@ func (s *AdminServer) serveWithListener(l net.Listener) (err error) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
wg.Done()
err := s.server.Serve(l)
if err != nil && !errors.Is(err, http.ErrServerClosed) {
s.logger.Error("failed to serve", zap.Error(err))
s.hc.Set(healthcheck.Broken)
}
}()

go func() {
wg.Wait()
}()
wg.Wait()
return nil
}

Expand Down

0 comments on commit 0f0d231

Please sign in to comment.