From 6c985132deb438e09b26e38f392bc18454992dbe Mon Sep 17 00:00:00 2001 From: Kyle Havlovitz Date: Wed, 13 Dec 2017 11:10:42 -0800 Subject: [PATCH] A few last autopilot adjustments --- agent/consul/autopilot/autopilot.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/consul/autopilot/autopilot.go b/agent/consul/autopilot/autopilot.go index f8b9d9c51..9bbc15e63 100644 --- a/agent/consul/autopilot/autopilot.go +++ b/agent/consul/autopilot/autopilot.go @@ -88,7 +88,7 @@ func (a *Autopilot) run() { return case <-ticker.C: if err := a.promoteServers(); err != nil { - a.logger.Printf("[ERR] autopilot: %v", err) + a.logger.Printf("[ERR] autopilot: Error promoting servers: %v", err) } if err := a.pruneDeadServers(); err != nil { @@ -145,6 +145,11 @@ func NumPeers(raftConfig raft.Configuration) int { // pruneDeadServers removes up to numPeers/2 failed servers func (a *Autopilot) pruneDeadServers() error { + conf := a.delegate.AutopilotConfig() + if conf == nil || !conf.CleanupDeadServers { + return nil + } + // Failed servers are known to Serf and marked failed, and stale servers // are known to Raft but not Serf. var failed []string