Skip to content

Commit d81723f

Browse files
committed
Improve error handling for server shutdown
1 parent e3b61ef commit d81723f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pkg/mcp-proxy/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,12 @@ func Run(
187187
err := <-errCh
188188
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 5*time.Second)
189189
defer shutdownCancel()
190-
_ = httpServer.Shutdown(shutdownCtx)
191-
_ = httpsServer.Shutdown(shutdownCtx)
190+
if shutdownErr := httpServer.Shutdown(shutdownCtx); shutdownErr != nil {
191+
logger.Warn("HTTP server shutdown error", zap.Error(shutdownErr))
192+
}
193+
if shutdownErr := httpsServer.Shutdown(shutdownCtx); shutdownErr != nil {
194+
logger.Warn("HTTPS server shutdown error", zap.Error(shutdownErr))
195+
}
192196
return err
193197
} else {
194198
logger.Info("Starting server", zap.String("listen", listen))

0 commit comments

Comments
 (0)