enhance: gracefully shutdown without error

This commit is contained in:
Jacky 2025-05-04 22:30:50 +08:00
parent 836e25f805
commit 8119f935de
No known key found for this signature in database
GPG key ID: 215C21B10DF38B4D

View file

@ -64,12 +64,7 @@ func Program(ctx context.Context, confPath string) func(l []net.Listener) error
}
// defer Shutdown to wait for ongoing requests to be served before returning
defer func(srv *http.Server, ctx context.Context) {
err := srv.Shutdown(ctx)
if err != nil {
logger.Fatal(err)
}
}(srv, ctx)
defer srv.Shutdown(ctx)
var err error
if cSettings.ServerSettings.EnableHTTPS {