fix: Add failure threshold to graceful shutdown
This commit is contained in:
parent
872d64b05c
commit
4f43d4a78c
1 changed files with 7 additions and 1 deletions
|
@ -400,12 +400,18 @@ func (n *NGINXController) stopWait() {
|
|||
var scraper collectors.NginxStatusScraper
|
||||
lastRequests := 0
|
||||
noChangeTimes := 0
|
||||
failures := 0
|
||||
const failureThreshold = 5
|
||||
|
||||
for ; ; time.Sleep(checkFrequency) {
|
||||
st, err := scraper.Scrape()
|
||||
if err != nil {
|
||||
klog.Warningf("failed to scrape nginx status: %v", err)
|
||||
noChangeTimes = 0
|
||||
failures++
|
||||
if failures >= failureThreshold {
|
||||
klog.Warningf("giving up graceful shutdown: too many nginx status scrape failures")
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue