Skip to content

Commit

Permalink
Refactor service stop signal message. (minio#4428)
Browse files Browse the repository at this point in the history
  • Loading branch information
deekoder authored May 31, 2017
1 parent 0f0758a commit 5621e6a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"os/exec"
"syscall"
"time"
)

// Type of service signals currently supported.
Expand Down Expand Up @@ -79,7 +80,6 @@ func (m *ServerMux) handleServiceSignals() error {
// We are usually done here, close global service done channel.
globalServiceDoneCh <- struct{}{}
}

// Wait for SIGTERM in a go-routine.
trapCh := signalTrap(os.Interrupt, syscall.SIGTERM)
go func(trapCh <-chan bool) {
Expand All @@ -102,7 +102,11 @@ func (m *ServerMux) handleServiceSignals() error {
}
runExitFn(nil)
case serviceStop:
log.Println("Gracefully stopping... (press Ctrl+C again to force)")
log.Println("Received signal to exit.")
go func() {
time.Sleep(serverShutdownPoll + time.Millisecond*100)
log.Println("Waiting for active connections to terminate - press Ctrl+C to quit immediately.")
}()
if err := m.Close(); err != nil {
errorIf(err, "Unable to close server gracefully")
}
Expand Down

0 comments on commit 5621e6a

Please sign in to comment.