Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
only update ASG once after all detach/delete instance request
Browse files Browse the repository at this point in the history
  • Loading branch information
thaibui committed Mar 6, 2019
1 parent 980154a commit 775eb56
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -673,13 +673,14 @@ public List<CloudResourceStatus> downscale(AuthenticatedContext auth, CloudStack
detachInstances(instanceIdsBatches, detachInstancesRequest, amazonASClient);
terminateInstances(instanceIdsBatches, amazonEC2Client);
LOGGER.info("Terminated instances in stack '{}': '{}'", auth.getCloudContext().getId(), instanceIdsBatches);
try {
amazonASClient.updateAutoScalingGroup(new UpdateAutoScalingGroupRequest()
.withAutoScalingGroupName(asGroupName)
.withMaxSize(getInstanceCount(stack, vms.get(0).getTemplate().getGroupName())));
} catch (AmazonServiceException e) {
LOGGER.warn(e.getErrorMessage());
}
}

try {
amazonASClient.updateAutoScalingGroup(new UpdateAutoScalingGroupRequest()
.withAutoScalingGroupName(asGroupName)
.withMaxSize(getInstanceCount(stack, vms.get(0).getTemplate().getGroupName())));
} catch (AmazonServiceException e) {
LOGGER.warn(e.getErrorMessage());
}
}
return check(auth, resources);
Expand Down

0 comments on commit 775eb56

Please sign in to comment.