Skip to content

Commit

Permalink
feat: client endpoint ignore empty
Browse files Browse the repository at this point in the history
  • Loading branch information
yinheli committed Dec 21, 2021
1 parent 07046a8 commit 7075928
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/xservice/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (t *clientImpl) GrpcClientConn(ctx context.Context, service string, desc *g
ctx, cancel := context.WithTimeout(ctx, t.options.GrpcClientDialTimeout)
defer cancel()

if len(endpoint) > 0 {
if len(endpoint) > 0 && endpoint[0] != "" {
c, err := grpc.DialContext(ctx, endpoint[0], options...)
if err != nil {
return nil, err
Expand Down Expand Up @@ -136,7 +136,7 @@ func (t *clientImpl) grpcClientKey(service string, desc *grpc.ServiceDesc, endpo
var sb strings.Builder
_, _ = sb.WriteString(service)
_, _ = sb.WriteString(desc.ServiceName)
if endpoint != nil {
if endpoint != nil && endpoint[0] != "" {
_, _ = sb.WriteString(endpoint[0])
}
return sb.String()
Expand Down

0 comments on commit 7075928

Please sign in to comment.