提交 3fc44fdf 编写于 作者: K kohsuke

removed pointless empty check that doesn't affect the execution.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@22984 71c3de6d-444a-0410-be80-ed276b4c234a
上级 fd4039af
...@@ -416,10 +416,11 @@ public class Queue extends ResourceController implements Saveable { ...@@ -416,10 +416,11 @@ public class Queue extends ResourceController implements Saveable {
* That said, one can still look at {@link WaitingItem#future}, {@link WaitingItem#id}, etc. * That said, one can still look at {@link WaitingItem#future}, {@link WaitingItem#id}, etc.
*/ */
private synchronized WaitingItem scheduleInternal(Task p, int quietPeriod, List<Action> actions) { private synchronized WaitingItem scheduleInternal(Task p, int quietPeriod, List<Action> actions) {
WaitingItem added=null; WaitingItem added;
Calendar due = new GregorianCalendar(); Calendar due = new GregorianCalendar();
due.add(Calendar.SECOND, quietPeriod); due.add(Calendar.SECOND, quietPeriod);
// Do we already have this task in the queue? Because if so, we won't schedule a new one.
List<Item> duplicatesInQueue = new ArrayList<Item>(); List<Item> duplicatesInQueue = new ArrayList<Item>();
for(Item item : getItems(p)) { for(Item item : getItems(p)) {
boolean shouldScheduleItem = false; boolean shouldScheduleItem = false;
...@@ -433,13 +434,15 @@ public class Queue extends ResourceController implements Saveable { ...@@ -433,13 +434,15 @@ public class Queue extends ResourceController implements Saveable {
duplicatesInQueue.add(item); duplicatesInQueue.add(item);
} }
} }
if (duplicatesInQueue.size() == 0) { if (duplicatesInQueue.isEmpty()) {
LOGGER.fine(p.getFullDisplayName() + " added to queue"); LOGGER.fine(p.getFullDisplayName() + " added to queue");
// put the item in the queue // put the item in the queue
waitingList.add(added=new WaitingItem(due,p,actions)); waitingList.add(added=new WaitingItem(due,p,actions));
} else { } else {
// the requested build is already queued, so will not be added // the requested build is already queued, so will not be added
added = null;
List<WaitingItem> waitingDuplicates = new ArrayList<WaitingItem>(); List<WaitingItem> waitingDuplicates = new ArrayList<WaitingItem>();
for(Item item : duplicatesInQueue) { for(Item item : duplicatesInQueue) {
for(FoldableAction a : Util.filter(actions,FoldableAction.class)) { for(FoldableAction a : Util.filter(actions,FoldableAction.class)) {
...@@ -448,11 +451,6 @@ public class Queue extends ResourceController implements Saveable { ...@@ -448,11 +451,6 @@ public class Queue extends ResourceController implements Saveable {
if ((item instanceof WaitingItem)) if ((item instanceof WaitingItem))
waitingDuplicates.add((WaitingItem)item); waitingDuplicates.add((WaitingItem)item);
} }
if(duplicatesInQueue.isEmpty()) {
// all duplicates in the queue are already in the blocked or
// buildable stage no need to requeue
return null;
}
// TODO: avoid calling scheduleMaintenance() if none of the waiting items // TODO: avoid calling scheduleMaintenance() if none of the waiting items
// actually change // actually change
for(WaitingItem wi : waitingDuplicates) { for(WaitingItem wi : waitingDuplicates) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册