From b3c24d080f4623952ac2d693b85e567ad51c78d2 Mon Sep 17 00:00:00 2001 From: Michael Lumish Date: Thu, 12 Sep 2024 14:31:01 -0700 Subject: [PATCH] grpc-js: round_robin: Request resolution on connection drop --- packages/grpc-js/package.json | 2 +- packages/grpc-js/src/load-balancer-round-robin.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/grpc-js/package.json b/packages/grpc-js/package.json index 73cbb2b95..5cb8796e8 100644 --- a/packages/grpc-js/package.json +++ b/packages/grpc-js/package.json @@ -1,6 +1,6 @@ { "name": "@grpc/grpc-js", - "version": "1.11.2", + "version": "1.11.3", "description": "gRPC Library for Node - pure JS implementation", "homepage": "https://grpc.io/", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", diff --git a/packages/grpc-js/src/load-balancer-round-robin.ts b/packages/grpc-js/src/load-balancer-round-robin.ts index 7e70c554f..6e2b0b11d 100644 --- a/packages/grpc-js/src/load-balancer-round-robin.ts +++ b/packages/grpc-js/src/load-balancer-round-robin.ts @@ -110,6 +110,13 @@ export class RoundRobinLoadBalancer implements LoadBalancer { channelControlHelper, { updateState: (connectivityState, picker) => { + /* Ensure that name resolution is requested again after active + * connections are dropped. This is more aggressive than necessary to + * accomplish that, so we are counting on resolvers to have + * reasonable rate limits. */ + if (this.currentState === ConnectivityState.READY && connectivityState !== ConnectivityState.READY) { + this.channelControlHelper.requestReresolution(); + } this.calculateAndUpdateState(); }, }