Toggle /ping to artificially return unhealthy response on SIGTERM during requestAcceptGraceTimeout interval

This commit is contained in:
ravilr 2018-03-22 10:18:03 -07:00 committed by Traefiker Bot
parent 9699dc2a85
commit 5792a19b97
5 changed files with 45 additions and 4 deletions

View file

@ -212,6 +212,9 @@ func (s *Server) StartWithContext(ctx context.Context) {
<-ctx.Done()
log.Info("I have to go...")
reqAcceptGraceTimeOut := time.Duration(s.globalConfiguration.LifeCycle.RequestAcceptGraceTimeout)
if s.globalConfiguration.Ping != nil && reqAcceptGraceTimeOut > 0 {
s.globalConfiguration.Ping.SetTerminating()
}
if reqAcceptGraceTimeOut > 0 {
log.Infof("Waiting %s for incoming requests to cease", reqAcceptGraceTimeOut)
time.Sleep(reqAcceptGraceTimeOut)