Do not surface left servers (#6420)

* do not surface left servers in catalog
This commit is contained in:
Hans Hasselberg 2019-10-09 05:16:00 +02:00 committed by Sarah Christoff
parent 8d4b8eae38
commit b6499fe6b8
1 changed files with 12 additions and 0 deletions

View File

@ -414,6 +414,12 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
continue 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] existing := index[parts.Datacenter]
if parts.Datacenter == r.localDatacenter { if parts.Datacenter == r.localDatacenter {
// Everything in the local datacenter looks like zero RTT. // Everything in the local datacenter looks like zero RTT.
@ -475,6 +481,12 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
continue 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) coord, ok := info.cluster.GetCachedCoordinate(parts.Name)
if ok { if ok {
entry := &structs.Coordinate{ entry := &structs.Coordinate{