Skip to content

Commit

Permalink
[FIXED JENKINS-39454] Do not consider pendings when deciding whether …
Browse files Browse the repository at this point in the history
…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 a57b52e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions core/src/main/java/hudson/model/Executor.java
Expand Up @@ -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);
}
Expand Down
13 changes: 11 additions & 2 deletions core/src/main/java/hudson/model/Queue.java
Expand Up @@ -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()});
}
}
}

Expand Down Expand Up @@ -1049,7 +1052,13 @@ private List<Item> liveGetItems(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);
Expand Down Expand Up @@ -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
}
}

Expand Down

0 comments on commit a57b52e

Please sign in to comment.