diff --git a/client/allocrunner/taskrunner/restarts/restarts.go b/client/allocrunner/taskrunner/restarts/restarts.go index e46d30312a0..9cb6d789d5b 100644 --- a/client/allocrunner/taskrunner/restarts/restarts.go +++ b/client/allocrunner/taskrunner/restarts/restarts.go @@ -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