feat: upgrade grpc to 1.46, and remove the deprecated grpc.WithBalancerName (#1820)

This commit is contained in:
Kevin Wan
2022-04-24 22:42:40 +08:00
committed by GitHub
parent 22b157bb6c
commit ec3e02624c
3 changed files with 23 additions and 15 deletions

View File

@@ -49,7 +49,10 @@ type (
// NewClient returns a Client.
func NewClient(target string, opts ...ClientOption) (Client, error) {
var cli client
opts = append([]ClientOption{WithDialOption(grpc.WithBalancerName(p2c.Name))}, opts...)
svcCfg := fmt.Sprintf(`{"loadBalancingPolicy":"%s"}`, p2c.Name)
balancerOpt := WithDialOption(grpc.WithDefaultServiceConfig(svcCfg))
opts = append([]ClientOption{balancerOpt}, opts...)
if err := cli.dial(target, opts...); err != nil {
return nil, err
}