Skip to content
Permalink
Browse files
Speculative fix for JENKINS-42397 by not doing redundant scans of par…
…allel branches
  • Loading branch information
svanoort committed Mar 21, 2017
1 parent 494446b commit 52459e140b5570c879c6383874f2f0b4e116660e
Showing with 4 additions and 6 deletions.
  1. +4 −6 src/main/java/org/jenkinsci/plugins/workflow/support/actions/LogActionImpl.java
@@ -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;
@@ -149,12 +150,9 @@ public FlowNode getParent() {
*/
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();
}

0 comments on commit 52459e1

Please sign in to comment.