mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
grpc-js: Fix handling of unsuccessful TXT record lookups
This commit is contained in:
parent
8d759b30ab
commit
1fc0895d17
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@grpc/grpc-js",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.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",
|
||||
|
||||
@ -237,19 +237,13 @@ class DnsResolver implements Resolver {
|
||||
}
|
||||
},
|
||||
(err) => {
|
||||
this.latestServiceConfigError = {
|
||||
code: Status.UNAVAILABLE,
|
||||
details: 'TXT query failed',
|
||||
metadata: new Metadata(),
|
||||
};
|
||||
if (this.latestLookupResult !== null) {
|
||||
this.listener.onSuccessfulResolution(
|
||||
this.latestLookupResult,
|
||||
this.latestServiceConfig,
|
||||
this.latestServiceConfigError,
|
||||
{}
|
||||
);
|
||||
}
|
||||
/* If TXT lookup fails we should do nothing, which means that we
|
||||
* continue to use the result of the most recent successful lookup,
|
||||
* or the default null config object if there has never been a
|
||||
* successful lookup. We do not set the latestServiceConfigError
|
||||
* here because that is specifically used for response validation
|
||||
* errors. We still need to handle this error so that it does not
|
||||
* bubble up as an unhandled promise rejection. */
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@ -60,10 +60,10 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||
/**
|
||||
* The service config object from the last successful resolution, if
|
||||
* available. A value of undefined indicates that there has not yet
|
||||
* been a successful resolution. A value of null indicates that the last
|
||||
* successful resolution explicitly provided a null service config.
|
||||
* been a successful resolution, or that the last succesful resolution
|
||||
* explicitly provided a null service config.
|
||||
*/
|
||||
private previousServiceConfig: ServiceConfig | null | undefined = undefined;
|
||||
private previousServiceConfig: ServiceConfig | null = null;
|
||||
|
||||
/**
|
||||
* The backoff timer for handling name resolution failures.
|
||||
@ -131,19 +131,13 @@ export class ResolvingLoadBalancer implements LoadBalancer {
|
||||
// Step 4 and 5
|
||||
if (serviceConfigError === null) {
|
||||
// Step 5
|
||||
this.previousServiceConfig = serviceConfig;
|
||||
this.previousServiceConfig = this.defaultServiceConfig;
|
||||
workingServiceConfig = this.defaultServiceConfig;
|
||||
} else {
|
||||
// Step 4
|
||||
if (this.previousServiceConfig === undefined) {
|
||||
if (this.previousServiceConfig === null) {
|
||||
// Step 4.ii
|
||||
if (this.defaultServiceConfig === null) {
|
||||
// Step 4.ii.b
|
||||
this.handleResolutionFailure(serviceConfigError);
|
||||
} else {
|
||||
// Step 4.ii.a
|
||||
workingServiceConfig = this.defaultServiceConfig;
|
||||
}
|
||||
this.handleResolutionFailure(serviceConfigError);
|
||||
} else {
|
||||
// Step 4.i
|
||||
workingServiceConfig = this.previousServiceConfig;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user