@Autowired
private RetryingStackUpdater stackUpdater;
@Override
public void accept(Event<StackUpdateSuccess> t) {
StackUpdateSuccess updateSuccess = t.getData();
Long stackId = updateSuccess.getStackId();
Stack stack = stackRepository.findOneWithLists(stackId);
MDCBuilder.buildMdcContext(stack);
LOGGER.info("Accepted {} event.", ReactorConfig.STACK_UPDATE_SUCCESS_EVENT);
Set<String> instanceIds = updateSuccess.getInstanceIds();
if (updateSuccess.isRemoveInstances()) {
stackUpdater.updateNodeCount(stackId, stack.getNodeCount() - instanceIds.size());
Set<InstanceMetaData> metadataToRemove = new HashSet<>();
for (InstanceMetaData metadataEntry : stack.getInstanceMetaData()) {
for (String instanceId : instanceIds) {
if (metadataEntry.getInstanceId().equals(instanceId)) {