Merge pull request #574 from metamx/srms-hopscotch

Autoscaling: Fix case where target < current, but target is too low.
This commit is contained in:
fjy 2014-06-02 13:38:33 -06:00
commit 8c73ef648c
1 changed files with 6 additions and 5 deletions

View File

@ -323,14 +323,15 @@ public class SimpleResourceManagementStrategy implements ResourceManagementStrat
);
}
final boolean atSteadyState = currentlyProvisioning.isEmpty()
&& currentlyTerminating.isEmpty()
&& validWorkers.size() == targetWorkerCount;
final boolean shouldScaleUp = atSteadyState
final boolean notTakingActions = currentlyProvisioning.isEmpty()
&& currentlyTerminating.isEmpty();
final boolean shouldScaleUp = notTakingActions
&& validWorkers.size() >= targetWorkerCount
&& targetWorkerCount < maxWorkerCount
&& (hasTaskPendingBeyondThreshold(pendingTasks)
|| targetWorkerCount < minWorkerCount);
final boolean shouldScaleDown = atSteadyState
final boolean shouldScaleDown = notTakingActions
&& validWorkers.size() == targetWorkerCount
&& targetWorkerCount > minWorkerCount
&& Iterables.any(validWorkers, isLazyWorker);
if (shouldScaleUp) {