Merge pull request #1925 from murgatroid99/grpc-js-xds_incremental_update_fix

grpc-js-xds: Fix RDS and EDS missing resource handling
This commit is contained in:
Michael Lumish 2021-10-06 09:51:12 -07:00 committed by GitHub
commit e5a13a5828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -163,7 +163,6 @@ export class EdsState implements XdsStreamState<ClusterLoadAssignment__Output> {
}
}
trace('Received EDS updates for cluster names ' + Array.from(allClusterNames));
this.handleMissingNames(allClusterNames);
return null;
}

View File

@ -163,8 +163,13 @@ export class LdsState implements XdsStreamState<Listener__Output> {
this.latestResponses = responses;
this.latestIsV2 = isV2;
const allTargetNames = new Set<string>();
const allRouteConfigNames = new Set<string>();
for (const message of responses) {
allTargetNames.add(message.name);
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL_V3, message.api_listener!.api_listener!.value);
if (httpConnectionManager.rds) {
allRouteConfigNames.add(httpConnectionManager.rds.route_config_name);
}
const watchers = this.watchers.get(message.name) ?? [];
for (const watcher of watchers) {
watcher.onValidUpdate(message, isV2);
@ -172,6 +177,7 @@ export class LdsState implements XdsStreamState<Listener__Output> {
}
trace('Received RDS response with route config names ' + Array.from(allTargetNames));
this.handleMissingNames(allTargetNames);
this.rdsState.handleMissingNames(allRouteConfigNames);
return null;
}

View File

@ -172,7 +172,7 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
return true;
}
private handleMissingNames(allRouteConfigNames: Set<string>) {
handleMissingNames(allRouteConfigNames: Set<string>) {
for (const [routeConfigName, watcherList] of this.watchers.entries()) {
if (!allRouteConfigNames.has(routeConfigName)) {
for (const watcher of watcherList) {
@ -200,7 +200,6 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
}
}
trace('Received RDS response with route config names ' + Array.from(allRouteConfigNames));
this.handleMissingNames(allRouteConfigNames);
return null;
}