Skip to content

Commit

Permalink
transport/grpc: WithGRPCConnectionPool is a no-op for some APIs
Browse files Browse the repository at this point in the history
Connection pooling is now done via transport/grpc.DialPool and is no
longer supported with transport/grpc.Dial.

See googleapis/google-cloud-go#1777 for
the list of packages that will no longer support gRPC connection
pooling after this change is merged.

Fixes #441

Change-Id: I8e05af53940d6e0af3c2acce9f81b49eaa78bd54
Reviewed-on: https://code-review.googlesource.com/c/google-api-go-client/+/50573
Reviewed-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Cody Oss <codyoss@google.com>
  • Loading branch information
broady authored and codyoss committed Mar 3, 2020
1 parent 747929a commit fe7fc1f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 124 deletions.
53 changes: 0 additions & 53 deletions internal/pool.go

This file was deleted.

66 changes: 0 additions & 66 deletions internal/pool_test.go

This file was deleted.

1 change: 1 addition & 0 deletions option/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func (w withGRPCDialOption) Apply(o *internal.DialSettings) {

// WithGRPCConnectionPool returns a ClientOption that creates a pool of gRPC
// connections that requests will be balanced between.
//
// This is an EXPERIMENTAL API and may be changed or removed in the future.
func WithGRPCConnectionPool(size int) ClientOption {
return withGRPCConnectionPool(size)
Expand Down
9 changes: 4 additions & 5 deletions transport/grpc/dial.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ func Dial(ctx context.Context, opts ...option.ClientOption) (*grpc.ClientConn, e
if o.GRPCConnPool != nil {
return o.GRPCConnPool.Conn(), nil
}
if o.GRPCConnPoolSize != 0 {
// NOTE(cbro): RoundRobin and WithBalancer are deprecated and we need to remove usages of it.
balancer := grpc.RoundRobin(internal.NewPoolResolver(o.GRPCConnPoolSize, o))
o.GRPCDialOpts = append(o.GRPCDialOpts, grpc.WithBalancer(balancer))
}
// NOTE(cbro): We removed support for option.WithGRPCConnPool (GRPCConnPoolSize)
// on 2020-02-12 because RoundRobin and WithBalancer are deprecated and we need to remove usages of it.
//
// Connection pooling is only done via DialPool.
return dial(ctx, false, o)
}

Expand Down

0 comments on commit fe7fc1f

Please sign in to comment.