Skip to content
Permalink
Browse files

[FIXED JENKINS-30705] Optimize TagCloud calculation

  • Loading branch information
olivergondza committed Sep 29, 2015
1 parent 699d2b2 commit 1b852010568dc3b21c0c296e2f0a2d6ff0b8bed3
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 1b85201

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