Skip to content

Commit

Permalink
Decline to cache a likely incorrect computation
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed Dec 7, 2022
1 parent b4772ca commit 4d701f6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/src/main/java/jenkins/model/Jenkins.java
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,14 @@ public synchronized Set<String> getAgentProtocols() {
result.add(name);
}
}
agentProtocols = result;
/*
* An empty result is almost never valid, but it can happen due to JENKINS-70206. Since we know the result
* is likely incorrect, at least decline to cache it so that a correct result can be computed later on
* rather than continuing to deliver the incorrect result indefinitely.
*/
if (!result.isEmpty()) {
agentProtocols = result;
}
return result;
}
return agentProtocols;
Expand Down

0 comments on commit 4d701f6

Please sign in to comment.