From 2c22315866a0a2366c95b952e3d2750582543545 Mon Sep 17 00:00:00 2001 From: Jon Bratseth Date: Fri, 18 Jun 2021 21:54:46 +0200 Subject: Could failures correctly --- .../maintenance/ScalingSuggestionsMaintainer.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'node-repository') diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java index 888f06a5004..b606e40ef42 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/ScalingSuggestionsMaintainer.java @@ -40,19 +40,15 @@ public class ScalingSuggestionsMaintainer extends NodeRepositoryMaintainer { if ( ! nodeRepository().zone().environment().isProduction()) return 1.0; int attempts = 0; - int successes = 0; + int failures = 0; for (var application : activeNodesByApplication().entrySet()) { - attempts++; - successes += suggest(application.getKey(), application.getValue()); + for (var cluster : nodesByCluster(application.getValue()).entrySet()) { + attempts++; + if ( ! suggest(application.getKey(), cluster.getKey(), cluster.getValue())) + failures++; + } } - return attempts == 0 ? 1.0 : ((double)successes / attempts); - } - - private int suggest(ApplicationId application, NodeList applicationNodes) { - int successes = 0; - for (var cluster : nodesByCluster(applicationNodes).entrySet()) - successes += suggest(application, cluster.getKey(), cluster.getValue()) ? 1 : 0; - return successes; + return asSuccessFactor(attempts, failures); } private Applications applications() { -- cgit v1.2.3