Skip to content

Commit

Permalink
[FIXED JENKINS-16397] Just displaying /asynchPeople constructed the e…
Browse files Browse the repository at this point in the history
…xpensive People object merely to decide whether or not to display the “REST API” link.

(cherry picked from commit 063acce)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and vjuranek committed Jan 25, 2013
1 parent 4998a37 commit 991158b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -55,6 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Improving responsiveness of <b>People</b> page.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16397">issue 16397</a>)
<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>)
Expand Down
20 changes: 18 additions & 2 deletions core/src/main/java/hudson/model/View.java
Expand Up @@ -28,7 +28,6 @@
import com.thoughtworks.xstream.io.StreamException;
import com.thoughtworks.xstream.io.xml.XppDriver;
import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.Functions;
import hudson.Indenter;
Expand Down Expand Up @@ -105,6 +104,8 @@

import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
import static jenkins.model.Jenkins.*;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

/**
* Encapsulates the rendering of the list of {@link TopLevelItem}s
Expand Down Expand Up @@ -846,7 +847,22 @@ public AsynchPeople(View parent) {
}

public Api getApi() {
return new Api(parent instanceof Jenkins ? new People((Jenkins) parent) : new People((View) parent));
return new Api(new People());
}

/** JENKINS-16397 workaround */
@Restricted(NoExternalUse.class)
@ExportedBean
public final class People {

private View.People people;

@Exported public synchronized List<UserInfo> getUsers() {
if (people == null) {
people = parent instanceof Jenkins ? new View.People((Jenkins) parent) : new View.People((View) parent);
}
return people.users;
}
}

}
Expand Down

0 comments on commit 991158b

Please sign in to comment.