Skip to content
Permalink
Browse files

[FIXED JENKINS-30705] Optimize TagCloud calculation

(cherry picked from commit 1b85201)
  • Loading branch information
olivergondza committed Oct 27, 2015
1 parent 4f7073f commit 9bebf2101c00e8c41c60853849cb1b3361bf8444
Showing with 5 additions and 1 deletion.
  1. +5 −1 core/src/main/java/hudson/model/Label.java
@@ -85,6 +85,7 @@
protected transient final String name;
private transient volatile Set<Node> nodes;
private transient volatile Set<Cloud> clouds;
private transient volatile int tiedJobsCount;

@Exported
public transient final LoadStatistics loadStatistics;
@@ -376,6 +377,8 @@ private String toString(Collection<? extends ModelObject> model) {
* @return a count of projects that are tied on this node.
*/
public int getTiedJobCount() {
if (tiedJobsCount != -1) return tiedJobsCount;

// denormalize for performance
// we don't need to respect security as much when returning a simple count
SecurityContext context = ACL.impersonate(ACL.SYSTEM);
@@ -412,7 +415,7 @@ public int getTiedJobCount() {
}
}
}
return result;
return tiedJobsCount = result;
} finally {
SecurityContextHolder.setContext(context);
}
@@ -433,6 +436,7 @@ public boolean isEmpty() {
/*package*/ void reset() {
nodes = null;
clouds = null;
tiedJobsCount = -1;
}

/**

0 comments on commit 9bebf21

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