Skip to content

Commit 276b7b6

Browse files
committed
grpc-js-xds: Fix limit representation for priority weight validation
1 parent 7282d06 commit 276b7b6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import { BaseXdsStreamState, HandleResponseResult, RejectedResourceEntry, Resour
2525

2626
const TRACER_NAME = 'xds_client';
2727

28+
const UINT32_MAX = 0xFFFFFFFF;
29+
2830
function trace(text: string): void {
2931
experimental.trace(logVerbosity.DEBUG, TRACER_NAME, text);
3032
}
@@ -88,7 +90,7 @@ export class EdsState extends BaseXdsStreamState<ClusterLoadAssignment__Output>
8890
priorityTotalWeights.set(endpoint.priority, (priorityTotalWeights.get(endpoint.priority) ?? 0) + (endpoint.load_balancing_weight?.value ?? 0));
8991
}
9092
for (const totalWeight of priorityTotalWeights.values()) {
91-
if (totalWeight >= 1<<32) {
93+
if (totalWeight > UINT32_MAX) {
9294
return false;
9395
}
9496
}

0 commit comments

Comments
 (0)