Skip to content

Commit

Permalink
Refactor hasComputationConverged (#116331)
Browse files Browse the repository at this point in the history
  • Loading branch information
pxsalehi authored and jozala committed Nov 13, 2024
1 parent 9896740 commit 9dfb331
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public DesiredBalance compute(
nextReportTime = currentTime + timeWarningInterval;
}

if (hasComputationConverged(hasChanges, i)) {
if (hasChanges == false && hasEnoughIterations(i)) {
logger.debug(
"Desired balance computation for [{}] converged after [{}] and [{}] iterations",
desiredBalanceInput.index(),
Expand Down Expand Up @@ -415,8 +415,8 @@ public DesiredBalance compute(
}

// visible for testing
boolean hasComputationConverged(boolean hasRoutingChanges, int currentIteration) {
return hasRoutingChanges == false;
boolean hasEnoughIterations(int currentIteration) {
return true;
}

private static Map<ShardId, ShardAssignment> collectShardAssignments(RoutingNodes routingNodes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ public DesiredBalance compute(
}

@Override
boolean hasComputationConverged(boolean hasRoutingChanges, int currentIteration) {
return super.hasComputationConverged(hasRoutingChanges, currentIteration) && currentIteration >= minIterations;
boolean hasEnoughIterations(int currentIteration) {
return currentIteration >= minIterations;
}
},
reconcileAction,
Expand Down

0 comments on commit 9dfb331

Please sign in to comment.