From 3debc272272024c5e8c232db3778eaf8e951717a Mon Sep 17 00:00:00 2001 From: wenxu12345 <44203734@qq.com> Date: Fri, 29 Apr 2022 17:04:15 +0800 Subject: [PATCH] config --- pkg/grpc-etcdv3/getcdv3/resolver.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/grpc-etcdv3/getcdv3/resolver.go b/pkg/grpc-etcdv3/getcdv3/resolver.go index 76e5643c9..18b2f8b57 100644 --- a/pkg/grpc-etcdv3/getcdv3/resolver.go +++ b/pkg/grpc-etcdv3/getcdv3/resolver.go @@ -44,19 +44,19 @@ func NewResolver(schema, etcdAddr, serviceName string) (*Resolver, error) { r.schema = schema r.etcdAddr = etcdAddr resolver.Register(&r) - - ctx, _ := context.WithTimeout(context.Background(), time.Second*5) - conn, err := grpc.DialContext(ctx, GetPrefix(schema, serviceName), - grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)), - grpc.WithInsecure()) + // + //ctx, _ := context.WithTimeout(context.Background(), time.Second*5) + //conn, err := grpc.DialContext(ctx, GetPrefix(schema, serviceName), + // grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)), + // grpc.WithInsecure()) log.Debug("", "etcd key ", GetPrefix(schema, serviceName), "value ", *r.grpcClientConn) - //conn, err := grpc.Dial( - // GetPrefix(schema, serviceName), - // grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)), - // grpc.WithInsecure(), - // grpc.WithTimeout(time.Duration(5)*time.Second), - //) + conn, err := grpc.Dial( + GetPrefix(schema, serviceName), + grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, roundrobin.Name)), + grpc.WithInsecure(), + grpc.WithTimeout(time.Duration(5)*time.Second), + ) if err == nil { r.grpcClientConn = conn }