Skip to content

Commit

Permalink
do not surface left servers in catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
hanshasselberg committed Aug 29, 2019
1 parent 2f37d68 commit f0cb17f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions agent/metadata/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func (s *Server) String() string {
return fmt.Sprintf("%s (Addr: %s/%s) (DC: %s)", s.Name, networkStr, addrStr, s.Datacenter)
}

func (s *Server) HasLeft() bool {
return s.Status == serf.StatusLeft
}

var versionFormat = regexp.MustCompile(`\d+\.\d+\.\d+`)

// IsConsulServer returns true if a serf member is a consul server
Expand Down
6 changes: 6 additions & 0 deletions agent/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,12 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
continue
}

if parts.HasLeft() {
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.
Expand Down

0 comments on commit f0cb17f

Please sign in to comment.