fix/resolver-weight-0
baozhecheng 2 years ago
parent 70535dc751
commit 05b5928114
  1. 2
      transport/grpc/resolver/discovery/resolver.go
  2. 2
      transport/http/resolver.go

@ -68,7 +68,7 @@ func (r *discoveryResolver) update(ins []*registry.ServiceInstance) {
continue
}
// filter weight <= 0
if w, ok := in.Metadata["weight"]; ok {
if w, ok := in.Metadata["weight"]; ok && w != "" {
if i, err := strconv.ParseInt(w, 10, 64); err == nil && i <= 0 {
continue
}

@ -132,7 +132,7 @@ func (r *resolver) update(services []*registry.ServiceInstance) bool {
continue
}
// filter weight <= 0
if w, ok := ins.Metadata["weight"]; ok {
if w, ok := ins.Metadata["weight"]; ok && w != "" {
if i, err := strconv.ParseInt(w, 10, 64); err == nil && i <= 0 {
continue
}

Loading…
Cancel
Save