mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
fix: do not os.Exit(1) while writing goroutines during shutdown (#17640)
Also shutdown poll add jitter, to verify if the shutdown sequence can finish before 500ms, this reduces the overall time taken during "restart" of the service. Provides speedup for `mc admin service restart` during active I/O, also ensures that systemd doesn't treat the returned 'error' as a failure, certain configurations in systemd can cause it to 'auto-restart' the process by-itself which can interfere with `mc admin service restart`. It can be observed how now restarting the service is much snappier.
This commit is contained in:
@@ -46,21 +46,17 @@ func handleSignals() {
|
||||
}
|
||||
|
||||
stopProcess := func() bool {
|
||||
var err, oerr error
|
||||
|
||||
// send signal to various go-routines that they need to quit.
|
||||
cancelGlobalContext()
|
||||
|
||||
if httpServer := newHTTPServerFn(); httpServer != nil {
|
||||
err = httpServer.Shutdown()
|
||||
if !errors.Is(err, http.ErrServerClosed) {
|
||||
if err := httpServer.Shutdown(); err != nil && !errors.Is(err, http.ErrServerClosed) {
|
||||
logger.LogIf(context.Background(), err)
|
||||
}
|
||||
}
|
||||
|
||||
if objAPI := newObjectLayerFn(); objAPI != nil {
|
||||
oerr = objAPI.Shutdown(context.Background())
|
||||
logger.LogIf(context.Background(), oerr)
|
||||
logger.LogIf(context.Background(), objAPI.Shutdown(context.Background()))
|
||||
}
|
||||
|
||||
if srv := newConsoleServerFn(); srv != nil {
|
||||
@@ -71,7 +67,7 @@ func handleSignals() {
|
||||
globalEventNotifier.RemoveAllBucketTargets()
|
||||
}
|
||||
|
||||
return (err == nil && oerr == nil)
|
||||
return true
|
||||
}
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user