Skip to content

Commit

Permalink
LRCI-4899 Do not return an offline or unreachable slave
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelhashimoto authored and brianchandotcom committed Nov 13, 2024
1 parent c883c78 commit a8ee7c7
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,17 @@ public List<JSONObject> getQueueItemJSONObjects() {
}

public JenkinsSlave getRandomJenkinsSlave() {
return JenkinsResultsParserUtil.getRandomListItem(getJenkinsSlaves());
List<JenkinsSlave> jenkinsSlaves = new ArrayList<>();

for (JenkinsSlave jenkinsSlave : getJenkinsSlaves()) {
if (jenkinsSlave.isOffline() || !jenkinsSlave.isReachable()) {
continue;
}

jenkinsSlaves.add(jenkinsSlave);
}

return JenkinsResultsParserUtil.getRandomListItem(jenkinsSlaves);
}

public String getRemoteURL() {
Expand Down

0 comments on commit a8ee7c7

Please sign in to comment.