1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-26 03:52:12 +02:00

fix: filter redundant endpoints invalid (#3373)

This commit is contained in:
chaos 2024-07-25 10:23:27 +08:00 committed by GitHub
parent 9260862c93
commit c550cdafb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -66,6 +66,7 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
if _, ok := endpoints[ept]; ok {
continue
}
endpoints[ept] = struct{}{}
filtered = append(filtered, in)
}
if r.subsetSize != 0 {
@ -75,7 +76,6 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
addrs := make([]resolver.Address, 0, len(filtered))
for _, in := range filtered {
ept, _ := endpoint.ParseEndpoint(in.Endpoints, endpoint.Scheme("grpc", !r.insecure))
endpoints[ept] = struct{}{}
addr := resolver.Address{
ServerName: in.Name,
Attributes: parseAttributes(in.Metadata).WithValue("rawServiceInstance", in),