diff options
Diffstat (limited to 'configserver')
-rw-r--r-- | configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java index 0dc7dbda9a1..48f23a1f7bd 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java @@ -113,13 +113,18 @@ public class RoutingStatusApiHandler extends RestApiRequestHandler<RoutingStatus RestApi.RequestContext.RequestContent requestContent = context.requestContentOrThrow(); Slime requestBody = Exceptions.uncheck(() -> SlimeUtils.jsonToSlime(requestContent.content().readAllBytes())); DeploymentRoutingStatus wantedStatus = deploymentRoutingStatusFromSlime(requestBody, clock.instant()); - DeploymentRoutingStatus currentStatus = deploymentStatus(upstreamNames.iterator().next()); - + List<DeploymentRoutingStatus> currentStatuses = upstreamNames.stream() + .map(this::deploymentStatus) + .collect(Collectors.toList()); + DeploymentRoutingStatus currentStatus = currentStatuses.get(0); // Redeploy application so that a new LbServicesConfig containing the updated status is generated and consumed - // by routing layer. This is required to update weights for application endpoints when routing status for a - // deployment is changed + // by routing layer. This is required to update status of upstreams in application endpoints log.log(Level.INFO, "Changing routing status of " + instance + " from " + currentStatus.status() + " to " + wantedStatus.status()); + boolean needsChange = currentStatuses.stream().anyMatch(status -> status.status() != wantedStatus.status()); + if (!needsChange) { + return new SlimeJsonResponse(toSlime(wantedStatus)); + } changeStatus(upstreamNames, wantedStatus); try { Optional<Deployment> deployment = deployer.deployFromLocalActive(instance, Duration.ofMinutes(1)); |