grpc-js-xds: Fix limit representation for priority weight validation

This commit is contained in:
Michael Lumish 2022-10-14 13:29:57 -07:00
parent 7282d06fae
commit 276b7b66d0
1 changed files with 3 additions and 1 deletions

View File

@ -25,6 +25,8 @@ import { BaseXdsStreamState, HandleResponseResult, RejectedResourceEntry, Resour
const TRACER_NAME = 'xds_client';
const UINT32_MAX = 0xFFFFFFFF;
function trace(text: string): void {
experimental.trace(logVerbosity.DEBUG, TRACER_NAME, text);
}
@ -88,7 +90,7 @@ export class EdsState extends BaseXdsStreamState<ClusterLoadAssignment__Output>
priorityTotalWeights.set(endpoint.priority, (priorityTotalWeights.get(endpoint.priority) ?? 0) + (endpoint.load_balancing_weight?.value ?? 0));
}
for (const totalWeight of priorityTotalWeights.values()) {
if (totalWeight >= 1<<32) {
if (totalWeight > UINT32_MAX) {
return false;
}
}