Add request accepting grace period delaying graceful shutdown.
This commit is contained in:
parent
fc550ac1fc
commit
1c98a9ad3e
10 changed files with 251 additions and 38 deletions
|
@ -5,6 +5,7 @@ package server
|
|||
import (
|
||||
"os/signal"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containous/traefik/log"
|
||||
)
|
||||
|
@ -31,7 +32,12 @@ func (server *Server) listenSignals() {
|
|||
}
|
||||
default:
|
||||
log.Infof("I have to go... %+v", sig)
|
||||
log.Info("Stopping server")
|
||||
reqAcceptGraceTimeOut := time.Duration(server.globalConfiguration.LifeCycle.RequestAcceptGraceTimeout)
|
||||
if reqAcceptGraceTimeOut > 0 {
|
||||
log.Infof("Waiting %s for incoming requests to cease", reqAcceptGraceTimeOut)
|
||||
time.Sleep(reqAcceptGraceTimeOut)
|
||||
}
|
||||
log.Info("Stopping server gracefully")
|
||||
server.Stop()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue