Skip to content

Commit

Permalink
Merge pull request #4949 from hashicorp/b-neg-running-summary
Browse files Browse the repository at this point in the history
Add guards around subtracting summary count
  • Loading branch information
Preetha authored Dec 4, 2018
2 parents d1cc66a + 5b39532 commit e5d125e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions nomad/state/state_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -3573,11 +3573,17 @@ func (s *StateStore) updateSummaryWithAlloc(index uint64, alloc *structs.Allocat
// Decrementing the count of the bin of the last state
switch existingAlloc.ClientStatus {
case structs.AllocClientStatusRunning:
tgSummary.Running -= 1
if tgSummary.Running > 0 {
tgSummary.Running -= 1
}
case structs.AllocClientStatusPending:
tgSummary.Starting -= 1
if tgSummary.Starting > 0 {
tgSummary.Starting -= 1
}
case structs.AllocClientStatusLost:
tgSummary.Lost -= 1
if tgSummary.Lost > 0 {
tgSummary.Lost -= 1
}
case structs.AllocClientStatusFailed, structs.AllocClientStatusComplete:
default:
s.logger.Error("invalid old client status for allocatio",
Expand Down

0 comments on commit e5d125e

Please sign in to comment.