|
|
|
@ -4,6 +4,7 @@ import ( |
|
|
|
|
"context" |
|
|
|
|
"encoding/json" |
|
|
|
|
"errors" |
|
|
|
|
"strconv" |
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
"google.golang.org/grpc/attributes" |
|
|
|
@ -66,6 +67,12 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) { |
|
|
|
|
if _, ok := endpoints[ept]; ok { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
// filter weight <= 0
|
|
|
|
|
if w, ok := in.Metadata["weight"]; ok { |
|
|
|
|
if i, err := strconv.ParseInt(w, 10, 64); err == nil && i <= 0 { |
|
|
|
|
continue |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
filtered = append(filtered, in) |
|
|
|
|
} |
|
|
|
|
if r.subsetSize != 0 { |
|
|
|
|