Skip to content

Commit

Permalink
grpc-js: Make a few improvements to DNS resolving timing
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Sep 11, 2023
1 parent e7e199c commit f1f8d1b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/grpc-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@grpc/grpc-js",
"version": "1.9.2",
"version": "1.9.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",
Expand Down
3 changes: 2 additions & 1 deletion packages/grpc-js/src/resolver-dns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class DnsResolver implements Resolver {
});
this.backoff.stop();
this.backoff.reset();
this.stopNextResolutionTimer();
return;
}
if (this.dnsHostname === null) {
Expand Down Expand Up @@ -339,9 +340,9 @@ class DnsResolver implements Resolver {
private startResolutionWithBackoff() {
if (this.pendingLookupPromise === null) {
this.continueResolving = false;
this.startResolution();
this.backoff.runOnce();
this.startNextResolutionTimer();
this.startResolution();
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/grpc-js/src/resolving-load-balancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ export class ResolvingLoadBalancer implements LoadBalancer {
configSelector: ConfigSelector | null,
attributes: { [key: string]: unknown }
) => {
this.backoffTimeout.stop();
this.backoffTimeout.reset();
let workingServiceConfig: ServiceConfig | null = null;
/* This first group of conditionals implements the algorithm described
* in https://github.com/grpc/proposal/blob/master/A21-service-config-error-handling.md
Expand Down

0 comments on commit f1f8d1b

Please sign in to comment.