Skip to content

Commit

Permalink
reinitalise targets when parsing host list (#313)
Browse files Browse the repository at this point in the history
* reinitalise targets when parsing host list

* remove metrics and logging changes
  • Loading branch information
dedelala authored Apr 23, 2024
1 parent 5ea7ded commit 11ccb3a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion go/vt/vtgateproxy/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
return false, fmt.Errorf("error parsing JSON discovery file %s: %v", b.jsonPath, err)
}

var targets []targetHost
for _, host := range hosts {
address, hasAddress := host[b.addressField]
port, hasPort := host[b.portField]
Expand Down Expand Up @@ -257,8 +258,9 @@ func (b *JSONGateResolverBuilder) parse() (bool, error) {
return false, fmt.Errorf("error parsing JSON discovery file %s: port field %s has invalid value %v", b.jsonPath, b.portField, port)
}

b.targets = append(b.targets, targetHost{fmt.Sprintf("%s:%s", address, port), poolType.(string), affinity.(string)})
targets = append(targets, targetHost{fmt.Sprintf("%s:%s", address, port), poolType.(string), affinity.(string)})
}
b.targets = targets

return true, nil
}
Expand Down

0 comments on commit 11ccb3a

Please sign in to comment.