From b6499fe6b879219f6e954f41ee7946fc1175ad77 Mon Sep 17 00:00:00 2001 From: Hans Hasselberg Date: Wed, 9 Oct 2019 05:16:00 +0200 Subject: [PATCH] Do not surface left servers (#6420) * do not surface left servers in catalog --- agent/router/router.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/agent/router/router.go b/agent/router/router.go index 0c3ac8f47e..697e285a13 100644 --- a/agent/router/router.go +++ b/agent/router/router.go @@ -414,6 +414,12 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) { continue } + if m.Status == serf.StatusLeft { + r.logger.Printf("[DEBUG]: consul: server %q in area %q left, skipping", + m.Name, areaID) + continue + } + existing := index[parts.Datacenter] if parts.Datacenter == r.localDatacenter { // Everything in the local datacenter looks like zero RTT. @@ -475,6 +481,12 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) { continue } + if m.Status == serf.StatusLeft { + r.logger.Printf("[DEBUG]: consul: server %q in area %q left, skipping", + m.Name, areaID) + continue + } + coord, ok := info.cluster.GetCachedCoordinate(parts.Name) if ok { entry := &structs.Coordinate{