Skip to content

Commit

Permalink
Speculative fix for JENKINS-42397 by not doing redundant scans of par…
Browse files Browse the repository at this point in the history
…allel branches
  • Loading branch information
svanoort committed Mar 21, 2017
1 parent 494446b commit 52459e1
Showing 1 changed file with 4 additions and 6 deletions.
Expand Up @@ -51,6 +51,7 @@
import org.jenkinsci.plugins.workflow.flow.GraphListener;
import org.jenkinsci.plugins.workflow.graph.BlockStartNode;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.graphanalysis.DepthFirstScanner;
import org.jenkinsci.plugins.workflow.graphanalysis.LinearBlockHoppingScanner;
import org.jenkinsci.plugins.workflow.steps.StepContext;
import org.jenkinsci.plugins.workflow.steps.StepContextParameter;
Expand Down Expand Up @@ -149,12 +150,9 @@ public AnnotatedLargeText<? extends FlowNode> getLogText() {
*/
private static boolean isRunning(FlowNode node) {
if (node instanceof BlockStartNode) {
for (FlowNode head : node.getExecution().getCurrentHeads()) {
if (new LinearBlockHoppingScanner().findFirstMatch(head, Predicates.equalTo(node)) != null) {
return true;
}
}
return false;
// Block start is considered running if currently executing nodes are part of the block
DepthFirstScanner scanner = new DepthFirstScanner();
return (scanner.findFirstMatch(node.getExecution().getCurrentHeads(), Predicates.equalTo(node)) != null) ? true : false;
} else {
return node.isRunning();
}
Expand Down

0 comments on commit 52459e1

Please sign in to comment.