Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed Nov 8, 2018
1 parent ccb7440 commit ad15649
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions nomad/deploymentwatcher/deployment_watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,12 @@ FAIL:
}

// If the next deadline is zero, we should not reset the timer
// as we aren't tracking towards a progress deadline yet.
// as we aren't tracking towards a progress deadline yet. This
// can happen if you have multiple task groups with progress
// deadlines and one of the task groups hasn't made any
// placements. As soon as the other task group finishes its
// rollout, the next progress deadline becomes zero, so we want
// to avoid resetting, causing a deployment failure.
if !next.IsZero() {
deadlineTimer.Reset(next.Sub(time.Now()))
}
Expand Down Expand Up @@ -855,6 +860,12 @@ func (w *deploymentWatcher) jobEvalStatus() (latestIndex uint64, err error) {
return 0, err
}

// If there are no evals for the job, return zero, since we want any
// allocation change to trigger an evaluation.
if len(evals) == 0 {
return 0, nil
}

var max uint64
for _, eval := range evals {
// A cancelled eval never impacts what the scheduler has saw, so do not
Expand All @@ -871,10 +882,5 @@ func (w *deploymentWatcher) jobEvalStatus() (latestIndex uint64, err error) {
}
}

if max == uint64(0) {
index, err := snap.Index("evals")
return index, err
}

return max, nil
}

0 comments on commit ad15649

Please sign in to comment.