Skip to content

Commit

Permalink
Merge pull request #5737 from fwkz/fix-restart-attempts
Browse files Browse the repository at this point in the history
Fix restart attempts of `restart` stanza in `delay` mode.
  • Loading branch information
Mahmood Ali authored Jun 5, 2019
2 parents 8ba7e52 + e2d793c commit d9ac7c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/allocrunner/taskrunner/restarts/restarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit d9ac7c2

Please sign in to comment.