grpc-js: round_robin: Request resolution on connection drop

This commit is contained in:
Michael Lumish 2024-09-12 14:31:01 -07:00
parent 0c5ab9876b
commit b3c24d080f
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@grpc/grpc-js", "name": "@grpc/grpc-js",
"version": "1.11.2", "version": "1.11.3",
"description": "gRPC Library for Node - pure JS implementation", "description": "gRPC Library for Node - pure JS implementation",
"homepage": "https://grpc.io/", "homepage": "https://grpc.io/",
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js", "repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

View File

@ -110,6 +110,13 @@ export class RoundRobinLoadBalancer implements LoadBalancer {
channelControlHelper, channelControlHelper,
{ {
updateState: (connectivityState, picker) => { 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(); this.calculateAndUpdateState();
}, },
} }