From 05b59281145f2540ebc69ba62878ebec18539fb3 Mon Sep 17 00:00:00 2001 From: baozhecheng Date: Fri, 14 Apr 2023 15:13:24 +0800 Subject: [PATCH] fix --- transport/grpc/resolver/discovery/resolver.go | 2 +- transport/http/resolver.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/transport/grpc/resolver/discovery/resolver.go b/transport/grpc/resolver/discovery/resolver.go index fdc51203d..6d12f7eda 100644 --- a/transport/grpc/resolver/discovery/resolver.go +++ b/transport/grpc/resolver/discovery/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 } diff --git a/transport/http/resolver.go b/transport/http/resolver.go index f12a33bcd..aae469f12 100644 --- a/transport/http/resolver.go +++ b/transport/http/resolver.go @@ -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 }