Skip to content

Commit

Permalink
fix(core): spotted that RollbackClusterStage was parallelizing regions!
Browse files Browse the repository at this point in the history
  • Loading branch information
robfletcher committed Apr 6, 2018
1 parent ef91d0c commit a6ef328
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ public RollbackClusterStage(RollbackServerGroupStage rollbackServerGroupStage,
}

@Override
public void taskGraph(@Nonnull Stage stage, @Nonnull TaskNode.Builder builder) {
public void taskGraph(
@Nonnull Stage stage, @Nonnull TaskNode.Builder builder) {
builder
.withTask("determineRollbackCandidates", DetermineRollbackCandidatesTask.class);
}

@Override
public void afterStages(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) {
public void afterStages(
@Nonnull Stage parent, @Nonnull StageGraphBuilder graph) {
StageData stageData = parent.mapTo(StageData.class);

Map<String, Object> parentOutputs = parent.getOutputs();
Expand Down Expand Up @@ -89,21 +91,19 @@ public void afterStages(@Nonnull Stage parent, @Nonnull StageGraphBuilder graph)
// propagate any attributes of the parent stage that are relevant to this rollback
context.putAll(propagateParentStageContext(parent.getParent()));

Stage rollbackStage = graph.add((it) -> {
graph.append((it) -> {
it.setType(rollbackServerGroupStage.getType());
it.setName("Rollback " + region);
it.setContext(context);
});

if (stageData.waitTimeBetweenRegions != null && regionsToRollback.indexOf(region) < regionsToRollback.size() - 1) {
// only add the waitStage if we're not the very last region!
graph.connect(
rollbackStage,
(it) -> {
it.setType(waitStage.getType());
it.setName("Wait after " + region);
it.setContext(Collections.singletonMap("waitTime", stageData.waitTimeBetweenRegions));
});
graph.append((it) -> {
it.setType(waitStage.getType());
it.setName("Wait after " + region);
it.setContext(Collections.singletonMap("waitTime", stageData.waitTimeBetweenRegions));
});
}
}
}
Expand Down

0 comments on commit a6ef328

Please sign in to comment.