Skip to content

Commit

Permalink
fix(pubsublite): disable grpc stream retries (#5019)
Browse files Browse the repository at this point in the history
Disable grpc-go automatically recreating streams. The Pub/Sub Lite library must reinitialize state when a new stream instance is created.
  • Loading branch information
tmdiep committed Oct 26, 2021
1 parent 39a8036 commit 74f9c11
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pubsublite/internal/wire/rpc.go
Expand Up @@ -193,9 +193,13 @@ func defaultClientOptions(region string) []option.ClientOption {
}

func streamClientOptions(region string) []option.ClientOption {
// To ensure most users don't hit the limit of 100 streams per connection, if
// they have a high number of topic partitions.
return append(defaultClientOptions(region), option.WithGRPCConnectionPool(8))
return append(defaultClientOptions(region),
// To ensure most users don't hit the limit of 100 streams per connection, if
// they have a high number of topic partitions.
option.WithGRPCConnectionPool(8),
// Stream reconnections must be handled here in order to reinitialize state,
// rather than in grpc-go.
option.WithGRPCDialOption(grpc.WithDisableRetry()))
}

// NewAdminClient creates a new gapic AdminClient for a region.
Expand Down

0 comments on commit 74f9c11

Please sign in to comment.