Skip to content

Commit a42d33d

Browse files
committed
fixed grpcinject call affect in NewClient
1 parent 7a58500 commit a42d33d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rpcplatform_newclient.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@ func (p *RPCPlatform) NewClient(target string, attributes *ClientAttributes) (*C
3333
balancerName := gears.UID()
3434
balancer.Register(balancerName, attributes.maxActiveServers)
3535

36-
resolver := resolver.NewResolver()
37-
38-
options := append(p.config.GRPCOptions.Client,
39-
grpc.WithResolvers(resolver),
40-
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"`+balancerName+`":{}}]}`),
41-
)
42-
4336
if err := p.grpcinject(gears.UID(), nil, ""); err != nil {
4437
return nil, err
4538
}
4639

40+
resolver := resolver.NewResolver()
41+
4742
c := &Client{
4843
target: p.config.EtcdPrefix + gears.FixPath(target) + "/",
4944
etcd: p.config.EtcdClient,
@@ -55,6 +50,11 @@ func (p *RPCPlatform) NewClient(target string, attributes *ClientAttributes) (*C
5550
return nil, err
5651
}
5752

53+
options := append(p.config.GRPCOptions.Client,
54+
grpc.WithResolvers(resolver),
55+
grpc.WithDefaultServiceConfig(`{"loadBalancingConfig":[{"`+balancerName+`":{}}]}`),
56+
)
57+
5858
c.client, err = grpc.NewClient(target, options...)
5959
if err != nil {
6060
return nil, err

0 commit comments

Comments
 (0)