Skip to content

Commit e5a13a5

Browse files
authored
Merge pull request #1925 from murgatroid99/grpc-js-xds_incremental_update_fix
grpc-js-xds: Fix RDS and EDS missing resource handling
2 parents 2767660 + c7d9598 commit e5a13a5

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

packages/grpc-js-xds/src/xds-stream-state/eds-state.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ export class EdsState implements XdsStreamState<ClusterLoadAssignment__Output> {
163163
}
164164
}
165165
trace('Received EDS updates for cluster names ' + Array.from(allClusterNames));
166-
this.handleMissingNames(allClusterNames);
167166
return null;
168167
}
169168

packages/grpc-js-xds/src/xds-stream-state/lds-state.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,21 @@ export class LdsState implements XdsStreamState<Listener__Output> {
163163
this.latestResponses = responses;
164164
this.latestIsV2 = isV2;
165165
const allTargetNames = new Set<string>();
166+
const allRouteConfigNames = new Set<string>();
166167
for (const message of responses) {
167168
allTargetNames.add(message.name);
169+
const httpConnectionManager = decodeSingleResource(HTTP_CONNECTION_MANGER_TYPE_URL_V3, message.api_listener!.api_listener!.value);
170+
if (httpConnectionManager.rds) {
171+
allRouteConfigNames.add(httpConnectionManager.rds.route_config_name);
172+
}
168173
const watchers = this.watchers.get(message.name) ?? [];
169174
for (const watcher of watchers) {
170175
watcher.onValidUpdate(message, isV2);
171176
}
172177
}
173178
trace('Received RDS response with route config names ' + Array.from(allTargetNames));
174179
this.handleMissingNames(allTargetNames);
180+
this.rdsState.handleMissingNames(allRouteConfigNames);
175181
return null;
176182
}
177183

packages/grpc-js-xds/src/xds-stream-state/rds-state.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class RdsState implements XdsStreamState<RouteConfiguration__Output> {
172172
return true;
173173
}
174174

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

0 commit comments

Comments
 (0)