From 74f9c112eadb83fea7b759f37ddb8ced9317f238 Mon Sep 17 00:00:00 2001 From: tmdiep Date: Tue, 26 Oct 2021 12:34:09 +1100 Subject: [PATCH] fix(pubsublite): disable grpc stream retries (#5019) Disable grpc-go automatically recreating streams. The Pub/Sub Lite library must reinitialize state when a new stream instance is created. --- pubsublite/internal/wire/rpc.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pubsublite/internal/wire/rpc.go b/pubsublite/internal/wire/rpc.go index b1646864f47..8512e7ab474 100644 --- a/pubsublite/internal/wire/rpc.go +++ b/pubsublite/internal/wire/rpc.go @@ -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.