Skip to content

Commit

Permalink
Fix handling of OD policy with no child
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Jun 27, 2023
1 parent b53f588 commit ed70a0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/grpc-js/src/load-balancer-outlier-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class OutlierDetectionLoadBalancingConfig implements LoadBalancingConfig
failurePercentageEjection: Partial<FailurePercentageEjectionConfig> | null,
private readonly childPolicy: LoadBalancingConfig[]
) {
if (childPolicy[0].getLoadBalancerName() === 'pick_first') {
if (childPolicy.length > 0 && childPolicy[0].getLoadBalancerName() === 'pick_first') {
throw new Error('outlier_detection LB policy cannot have a pick_first child policy');
}
this.intervalMs = intervalMs ?? 10_000;
Expand Down

0 comments on commit ed70a0b

Please sign in to comment.