Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow-up fixes to Nodes refactoring #9053

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/src/main/java/hudson/model/Queue.java
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@
Label lbl = p.getAssignedLabel();

Computer masterComputer = h.toComputer();
if (lbl != null && lbl.equals(h.getSelfLabel())) {
if (lbl != null && lbl.equals(h.getSelfLabel()) && masterComputer != null) {

Check warning on line 1754 in core/src/main/java/hudson/model/Queue.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1754 is only partially covered, one branch is missing
// the flyweight task is bound to the master
if (h.canTake(p) == null) {
return createFlyWeightTaskRunnable(p, masterComputer);
Expand All @@ -1760,7 +1760,7 @@
}
}

if (lbl == null && h.canTake(p) == null && masterComputer.isOnline() && masterComputer.isAcceptingTasks()) {
if (lbl == null && h.canTake(p) == null && masterComputer != null && masterComputer.isOnline() && masterComputer.isAcceptingTasks()) {

Check warning on line 1763 in core/src/main/java/hudson/model/Queue.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 1763 is only partially covered, 3 branches are missing
// The flyweight task is not tied to a specific label, so execute on master if possible.
// This will ensure that actual agent disconnects do not impact flyweight tasks randomly assigned to them.
return createFlyWeightTaskRunnable(p, masterComputer);
Expand Down Expand Up @@ -1794,7 +1794,7 @@
return null;
}

private Runnable createFlyWeightTaskRunnable(final BuildableItem p, final Computer c) {
private Runnable createFlyWeightTaskRunnable(final BuildableItem p, final @NonNull Computer c) {
if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, "Creating flyweight task {0} for computer {1}",
new Object[]{p.task.getFullDisplayName(), c.getName()});
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/java/jenkins/model/Nodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,6 @@ public Node getNode(String name) {
*/
public void load() throws IOException {
final File nodesDir = getRootDir();
if (!nodesDir.exists()) {
return;
}
final File[] subdirs = nodesDir.listFiles(File::isDirectory);
final Map<String, Node> newNodes = new TreeMap<>();
if (subdirs != null) {
Expand Down
Loading