Skip to content

Commit

Permalink
Merge pull request #108 from hashicorp/f-skip-action-when-count-doesn…
Browse files Browse the repository at this point in the history
…t-change

skip action when count doesn't change
  • Loading branch information
lgfa29 authored Apr 28, 2020
2 parents 2af3278 + fc39078 commit 5a61d67
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,12 @@ func (a *Agent) handlePolicy(p *policystorage.Policy) {
actionLogger.Info("registering scaling event",
"count", currentCount, "reason", action.Reason, "meta", action.Meta)
} else {
// Skip action if count doesn't change.
if currentCount == *action.Count {
actionLogger.Info("nothing to do", "from", currentCount, "to", *action.Count)
continue
}

actionLogger.Info("scaling target",
"from", currentCount, "to", *action.Count,
"reason", action.Reason, "meta", action.Meta)
Expand Down

0 comments on commit 5a61d67

Please sign in to comment.