@@ -1615,6 +1615,8 @@ public void maintain() {
16151615 // Ensure that identification of blocked tasks is using the live state: JENKINS-27708 & JENKINS-27871
16161616 updateSnapshot ();
16171617
1618+ // put label has no candidates here to accelerate the buildableItem circle
1619+ List <Label > noCandidateLabels = new ArrayList <>();
16181620 // allocate buildable jobs to executors
16191621 for (BuildableItem p : new ArrayList <>(
16201622 buildables )) { // copy as we'll mutate the list in the loop
@@ -1630,6 +1632,10 @@ public void maintain() {
16301632 continue ;
16311633 }
16321634
1635+ Label itemLabel = p .getAssignedLabel ();
1636+ if (noCandidateLabels .contains (itemLabel )) {
1637+ continue ;
1638+ }
16331639 String taskDisplayName = LOGGER .isLoggable (Level .FINEST ) ? p .task .getFullDisplayName () : null ;
16341640
16351641 if (p .task instanceof FlyweightTask ) {
@@ -1673,6 +1679,11 @@ public void maintain() {
16731679 new Object []{p , candidates , parked .values ()});
16741680 List <CauseOfBlockage > reasons = reasonMap .values ().stream ().filter (Objects ::nonNull ).collect (Collectors .toList ());
16751681 p .transientCausesOfBlockage = reasons .isEmpty () ? null : reasons ;
1682+ // If no candidates, mark the label and end this loop early.
1683+ if (candidates .isEmpty ()) {
1684+ noCandidateLabels .add (itemLabel );
1685+ LOGGER .log (Level .FINEST , "{0} changes to the state of no candidate executor" , itemLabel );
1686+ }
16761687 continue ;
16771688 }
16781689
0 commit comments