Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-16244] View.hasPeople too slow to use in sidepanel.jelly.
  • Loading branch information
jglick committed Jan 2, 2013
1 parent 74b2585 commit 73aac10
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion changelog.html
Expand Up @@ -55,7 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
Slow rendering of view pages in large installations due to eager check whether the “People” link would show anything.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16244">issue 16244</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/hudson/model/View.java
Expand Up @@ -629,6 +629,7 @@ private long ordinal() {

/**
* Does this {@link View} has any associated user information recorded?
* @deprecated Potentially very expensive call; do not use from Jelly views.
*/
public boolean hasPeople() {
return People.isApplicable(getItems());
Expand Down Expand Up @@ -710,6 +711,9 @@ public Api getApi() {
return new Api(this);
}

/**
* @deprecated Potentially very expensive call; do not use from Jelly views.
*/
public static boolean isApplicable(Collection<? extends Item> items) {
for (Item item : items) {
for (Job job : item.getAllJobs()) {
Expand Down Expand Up @@ -787,6 +791,7 @@ public AsynchPeople(View parent) {
}
}
}
// XXX consider also adding the user of the UserCause when applicable
buildCount++;
progress((itemCount + 1.0 * buildCount / builds.size()) / (items.size() + 1));
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -981,6 +981,7 @@ public View.AsynchPeople getAsynchPeople() {

/**
* Does this {@link View} has any associated user information recorded?
* @deprecated Potentially very expensive call; do not use from Jelly views.
*/
public boolean hasPeople() {
return View.People.isApplicable(items.values());
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/resources/hudson/model/View/sidepanel.jelly
Expand Up @@ -47,9 +47,9 @@ THE SOFTWARE.
<j:when test="${it.class.name=='hudson.model.AllView'}">
<l:task icon="images/24x24/user.png" href="${rootURL}/asynchPeople/" title="${%People}" />
</j:when>
<j:when test="${it.isDefault() or it.hasPeople()}">
<j:otherwise>
<l:task icon="images/24x24/user.png" href="${rootURL}/${it.viewUrl}asynchPeople/" title="${%People}" />
</j:when>
</j:otherwise>
</j:choose>
<l:task icon="images/24x24/notepad.png" href="${rootURL}/${it.viewUrl}builds" title="${%Build History}"/>
<j:if test="${it.isEditable()}">
Expand Down

0 comments on commit 73aac10

Please sign in to comment.