Fix restart attempts of restart stanza.

Number of restarts during 2nd interval is off by one.
This commit is contained in:
fwkz
2019-05-21 13:27:19 +02:00
parent 59946ff70f
commit e2d793cfd9

View File

@@ -169,8 +169,6 @@ func (r *RestartTracker) GetState() (string, time.Duration) {
return structs.TaskNotRestarting, 0
}
r.count++
// Check if we have entered a new interval.
end := r.startTime.Add(r.policy.Interval)
now := time.Now()
@@ -179,6 +177,8 @@ func (r *RestartTracker) GetState() (string, time.Duration) {
r.startTime = now
}
r.count++
// Handle restarts due to failures
if !r.failure {
return "", 0