Skip to content

Commit 1ff7dca

Browse files
authored
Merge pull request #2247 from murgatroid99/grpc-js-xds_fix_weight_check
grpc-js-xds: Fix limit representation for priority weight validation
2 parents 7282d06 + 276b7b6 commit 1ff7dca

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)