Skip to content
Permalink
Browse files

[FIXED JENKINS-39454] Do not consider pendings when deciding whether …

…a schedule result should be new or existing, as we have already taken a snapshot of actions. (#2609)
  • Loading branch information...
jglick authored and oleg-nenashev committed Nov 5, 2016
1 parent 58e1228 commit a57b52ec7e16d9b9985d6303e918aa6fdfa0a141
Showing with 14 additions and 2 deletions.
  1. +3 −0 core/src/main/java/hudson/model/Executor.java
  2. +11 −2 core/src/main/java/hudson/model/Queue.java
@@ -389,6 +389,9 @@ public SubTask call() throws Exception {
}

if (executable instanceof Actionable) {
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.log(FINER, "when running {0} from {1} we are copying {2} actions whereas the item currently has {3}", new Object[] {executable, workUnit.context.item, workUnit.context.actions, workUnit.context.item.getAllActions()});
}
for (Action action: workUnit.context.actions) {
((Actionable) executable).addAction(action);
}
@@ -612,6 +612,9 @@ public WaitingItem schedule(Task p, int quietPeriod, List<Action> actions) {
for (Item item : duplicatesInQueue) {
for (FoldableAction a : Util.filter(actions, FoldableAction.class)) {
a.foldIntoExisting(item, p, actions);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "after folding {0}, {1} includes {2}", new Object[] {a, item, item.getAllActions()});
}
}
}

@@ -1049,7 +1052,13 @@ public Item getItem(Task t) {
List<Item> result = new ArrayList<Item>();
result.addAll(blockedProjects.getAll(t));
result.addAll(buildables.getAll(t));
result.addAll(pendings.getAll(t));
// Do not include pendings—we have already finalized WorkUnitContext.actions.
if (LOGGER.isLoggable(Level.FINE)) {
List<BuildableItem> thePendings = pendings.getAll(t);
if (!thePendings.isEmpty()) {
LOGGER.log(Level.FINE, "ignoring {0} during scheduleInternal", thePendings);
}
}
for (Item item : waitingList) {
if (item.task.equals(t)) {
result.add(item);
@@ -1414,7 +1423,7 @@ public void maintain() {
p.task.getFullDisplayName());
p.isPending = false;
pendings.remove(p);
makeBuildable(p);
makeBuildable(p); // TODO whatever this is for, the return value is being ignored, so this does nothing at all
}
}

0 comments on commit a57b52e

Please sign in to comment.
You can’t perform that action at this time.