提交 65d1fe5b 编写于 作者: V Valentina Armenise

[JENKINS-30084] some more polish

上级 eb52333d
...@@ -1500,8 +1500,9 @@ public class Queue extends ResourceController implements Saveable { ...@@ -1500,8 +1500,9 @@ public class Queue extends ResourceController implements Saveable {
m.execute(wuc); m.execute(wuc);
p.leave(this); p.leave(this);
if (!wuc.getWorkUnits().isEmpty()) if (!wuc.getWorkUnits().isEmpty()) {
makePending(p); makePending(p);
}
else else
LOGGER.log(Level.FINE, "BuildableItem {0} with empty work units!?", p); LOGGER.log(Level.FINE, "BuildableItem {0} with empty work units!?", p);
...@@ -1557,6 +1558,7 @@ public class Queue extends ResourceController implements Saveable { ...@@ -1557,6 +1558,7 @@ public class Queue extends ResourceController implements Saveable {
* @param p - the flyweight task to be scheduled * @param p - the flyweight task to be scheduled
* @return a Runnable if there is an executor that can take the task, null otherwise * @return a Runnable if there is an executor that can take the task, null otherwise
*/ */
@CheckForNull
private Runnable makeFlyWeightTaskBuildable(final BuildableItem p){ private Runnable makeFlyWeightTaskBuildable(final BuildableItem p){
//we double check if this is a flyweight task //we double check if this is a flyweight task
if (p.task instanceof FlyweightTask) { if (p.task instanceof FlyweightTask) {
...@@ -1575,10 +1577,10 @@ public class Queue extends ResourceController implements Saveable { ...@@ -1575,10 +1577,10 @@ public class Queue extends ResourceController implements Saveable {
for (Node n : hash.list(p.task.getFullDisplayName())) { for (Node n : hash.list(p.task.getFullDisplayName())) {
final Computer c = n.toComputer(); final Computer c = n.toComputer();
if (n.canTake(p) != null) { if (c == null || c.isOffline()) {
continue; continue;
} }
if (c == null || c.isOffline()) { if (n.canTake(p) != null) {
continue; continue;
} }
return new Runnable() { return new Runnable() {
......
...@@ -800,6 +800,7 @@ public class QueueTest { ...@@ -800,6 +800,7 @@ public class QueueTest {
r.jenkins.clouds.add(dummyCloud); r.jenkins.clouds.add(dummyCloud);
project.setAssignedLabel(label); project.setAssignedLabel(label);
r.assertBuildStatusSuccess(project.scheduleBuild2(0)); r.assertBuildStatusSuccess(project.scheduleBuild2(0));
assertEquals("aws-linux-dummy", project.getBuilds().getLastBuild().getBuiltOn().getLabelString());
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册