Skip to content
Permalink
Browse files

optimize Job Statistics portlet

Loading every build for every job can be expensive, especially in
pathologically cases with > 10k builds per job.  Fortunately the
portlet only needs to know that a non-zero number of builds exist and
not any of their details.

Problem diagnosed and fix approach proposed by Matthew Sawin

[FIXED JENKINS-26879]
  • Loading branch information...
cburroughs committed Aug 5, 2015
1 parent d3862e1 commit 4eff12fc24bb09ab9c95bc0bd60eb28f3e75cd8d
Showing with 1 addition and 2 deletions.
  1. +1 −2 src/main/java/hudson/plugins/view/dashboard/stats/StatJobs.java
@@ -51,7 +51,6 @@ public StatJobs(String name) {

public static HealthStatus getHealthStatus(Job job) {
int score = job.getBuildHealth().getScore();
int nBuilds = job.getBuilds().size();
if (score < 20) {
return HEALTH_0_TO_19;
}
@@ -65,7 +64,7 @@ public static HealthStatus getHealthStatus(Job job) {
return HEALTH_60_TO_79;
}

return nBuilds != 0 ? HEALTH_OVER_80 : HEALTH_UNKNOWN;
return job.getFirstBuild() != null ? HEALTH_OVER_80 : HEALTH_UNKNOWN;
}

public String getIconUrl() {

0 comments on commit 4eff12f

Please sign in to comment.
You can’t perform that action at this time.