Skip to content

Commit

Permalink
Fix restart attempts of restart stanza.
Browse files Browse the repository at this point in the history
Number of restarts during 2nd interval is off by one.
  • Loading branch information
fwkz committed May 21, 2019
1 parent 59946ff commit e2d793c
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 e2d793c

Please sign in to comment.