mirror of https://github.com/grpc/grpc-node.git
grpc-js-xds: NACK WeightedCluster if total_weight is 0
This commit is contained in:
parent
b8c0cdc480
commit
02a43a302d
|
@ -89,6 +89,9 @@ export class RdsState extends BaseXdsStreamState<RouteConfiguration__Output> imp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (route.route!.cluster_specifier === 'weighted_clusters') {
|
if (route.route!.cluster_specifier === 'weighted_clusters') {
|
||||||
|
if (route.route.weighted_clusters!.total_weight?.value === 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
let weightSum = 0;
|
let weightSum = 0;
|
||||||
for (const clusterWeight of route.route.weighted_clusters!.clusters) {
|
for (const clusterWeight of route.route.weighted_clusters!.clusters) {
|
||||||
weightSum += clusterWeight.weight?.value ?? 0;
|
weightSum += clusterWeight.weight?.value ?? 0;
|
||||||
|
|
Loading…
Reference in New Issue