Skip to content

Commit f1f8d1b

Browse files
committed
grpc-js: Make a few improvements to DNS resolving timing
1 parent e7e199c commit f1f8d1b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

packages/grpc-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/grpc-js",
3-
"version": "1.9.2",
3+
"version": "1.9.3",
44
"description": "gRPC Library for Node - pure JS implementation",
55
"homepage": "https://grpc.io/",
66
"repository": "https://github.com/grpc/grpc-node/tree/master/packages/grpc-js",

packages/grpc-js/src/resolver-dns.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ class DnsResolver implements Resolver {
175175
});
176176
this.backoff.stop();
177177
this.backoff.reset();
178+
this.stopNextResolutionTimer();
178179
return;
179180
}
180181
if (this.dnsHostname === null) {
@@ -339,9 +340,9 @@ class DnsResolver implements Resolver {
339340
private startResolutionWithBackoff() {
340341
if (this.pendingLookupPromise === null) {
341342
this.continueResolving = false;
342-
this.startResolution();
343343
this.backoff.runOnce();
344344
this.startNextResolutionTimer();
345+
this.startResolution();
345346
}
346347
}
347348

packages/grpc-js/src/resolving-load-balancer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ export class ResolvingLoadBalancer implements LoadBalancer {
247247
configSelector: ConfigSelector | null,
248248
attributes: { [key: string]: unknown }
249249
) => {
250+
this.backoffTimeout.stop();
251+
this.backoffTimeout.reset();
250252
let workingServiceConfig: ServiceConfig | null = null;
251253
/* This first group of conditionals implements the algorithm described
252254
* in https://github.com/grpc/proposal/blob/master/A21-service-config-error-handling.md

0 commit comments

Comments
 (0)