Skip to content

Commit

Permalink
Fix address list collection
Browse files Browse the repository at this point in the history
  • Loading branch information
jscheinblum committed Nov 2, 2023
1 parent 144f7e5 commit 7b789f5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ func (r *resolveJSONGateConfig) loadConfig() (*[]resolver.Address, error) {

fmt.Printf("%v\n", config)

addrs := make([]resolver.Address, len(config))
for i, s := range config {
addrs := []resolver.Address{}
for _, s := range config {
// Apply filters
if r.filters.gate_type != "" {
if r.filters.gate_type != s.Type {
Expand All @@ -138,7 +138,8 @@ func (r *resolveJSONGateConfig) loadConfig() (*[]resolver.Address, error) {
}
}
// Add matching hosts to registration list
addrs[i] = resolver.Address{Addr: fmt.Sprintf("%s:%s", s.Address, s.Grpc)}
fmt.Printf("selected host for discovery: %v %v\n", fmt.Sprintf("%s:%s", s.Address, s.Grpc), s)
addrs = append(addrs, resolver.Address{Addr: fmt.Sprintf("%s:%s", s.Address, s.Grpc)})
}

// Shuffle to ensure every host has a different order to iterate through
Expand Down

0 comments on commit 7b789f5

Please sign in to comment.