mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
Merge pull request #2247 from murgatroid99/grpc-js-xds_fix_weight_check
grpc-js-xds: Fix limit representation for priority weight validation
This commit is contained in:
commit
1ff7dca7e1
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user