allow ctrl+c to be consistent at early startup (#10435)

fixes #10431
This commit is contained in:
Harshavardhana
2020-09-08 09:10:55 -07:00
committed by GitHub
parent 86a3319d41
commit 96997d2b21
4 changed files with 36 additions and 37 deletions

View File

@@ -18,8 +18,6 @@ package cmd
import (
"context"
"errors"
"net/http"
"os"
"strings"
@@ -46,6 +44,9 @@ func handleSignals() {
stopProcess := func() bool {
var err, oerr error
// send signal to various go-routines that they need to quit.
cancelGlobalContext()
if globalNotificationSys != nil {
globalNotificationSys.RemoveAllRemoteTargets()
}
@@ -55,9 +56,6 @@ func handleSignals() {
logger.LogIf(context.Background(), err)
}
// send signal to various go-routines that they need to quit.
cancelGlobalContext()
if objAPI := newObjectLayerWithoutSafeModeFn(); objAPI != nil {
oerr = objAPI.Shutdown(context.Background())
logger.LogIf(context.Background(), oerr)
@@ -68,14 +66,8 @@ func handleSignals() {
for {
select {
case err := <-globalHTTPServerErrorCh:
if objAPI := newObjectLayerWithoutSafeModeFn(); objAPI != nil {
objAPI.Shutdown(context.Background())
}
if err != nil && !errors.Is(err, http.ErrServerClosed) {
logger.Fatal(err, "Unable to start MinIO server")
}
exit(true)
case <-globalHTTPServerErrorCh:
exit(stopProcess())
case osSignal := <-globalOSSignalCh:
logger.Info("Exiting on signal: %s", strings.ToUpper(osSignal.String()))
exit(stopProcess())