Skip to content

Commit

Permalink
fix web server shutdown message (#181)
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Paskal <paskal.maksim@gmail.com>
  • Loading branch information
maksim-paskal authored Oct 5, 2023
1 parent a79741a commit 4fa8f46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/main/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,6 @@ func main() {
go RunLeaderElection(ctx)
}

go web.StartServer(ctx)

go func() {
select {
case <-signalChanInterrupt:
Expand All @@ -156,6 +154,8 @@ func main() {
time.Sleep(config.Get().GetGracefulShutdown())
})

go web.StartServer(ctx)

<-ctx.Done()

log.Info("Shutting down...")
Expand Down
2 changes: 1 addition & 1 deletion pkg/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func StartServer(ctx context.Context) {
_ = server.Shutdown(ctx) //nolint:contextcheck
}()

if err := server.ListenAndServe(); err != nil && ctx.Err() != nil {
if err := server.ListenAndServe(); err != nil && ctx.Err() == nil {
log.WithError(err).Fatal()
}
}
Expand Down

0 comments on commit 4fa8f46

Please sign in to comment.