Skip to content
Permalink
Browse files
[JENKINS-16342] Improving responsiveness of asynchPeople when Gravata…
…r plugin is in use.

This change does not necessarily improve total performance, since the avatar is still computed.
But (1) the computation is correctly done in the work thread, not in the HTTP response thread;
(2) the computation is done just once for a given User, which could reduce load when many AJAX checks are done.(cherry picked from commit c757e65)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and vjuranek committed Jan 25, 2013
1 parent 7bc441d commit bd03abbcc0078c2f250c2e3ee2c8d3c4a9d210ca
Showing with 18 additions and 8 deletions.
  1. +2 −1 changelog.html
  2. +16 −7 core/src/main/java/hudson/model/View.java
@@ -66,7 +66,8 @@
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-6604">issue 6604</a>)
<li class=bug>
Improving responsiveness of <b>People</b> page.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16397">issue 16397</a>)
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16342">issue 16342</a>,
<a href="https://issues.jenkins-ci.org/browse/JENKINS-16397">issue 16397</a>)
<li class=bug>
JNLP slave index page failed to explain how to pass <code>-jnlpCredentials</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16273">issue 16273</a>)
@@ -585,6 +585,9 @@ public boolean hasPermission(Permission p) {
*/
private AbstractProject project;

/** @see UserAvatarResolver */
String avatar;

UserInfo(User user, AbstractProject p, Calendar lastChange) {
this.user = user;
this.project = p;
@@ -786,12 +789,16 @@ public AsynchPeople(View parent) {
}
for (ChangeLogSet.Entry entry : build.getChangeSet()) {
User user = entry.getAuthor();
synchronized (this) {
UserInfo info = users.get(user);
if (info == null) {
users.put(user, new UserInfo(user, p, build.getTimestamp()));
UserInfo info = users.get(user);
if (info == null) {
UserInfo userInfo = new UserInfo(user, p, build.getTimestamp());
userInfo.avatar = UserAvatarResolver.resolve(user, iconSize);
synchronized (this) {
users.put(user, userInfo);
modified.add(user);
} else if (info.getLastChange().before(build.getTimestamp())) {
}
} else if (info.getLastChange().before(build.getTimestamp())) {
synchronized (this) {
info.project = p;
info.lastChange = build.getTimestamp();
modified.add(user);
@@ -816,8 +823,10 @@ public AsynchPeople(View parent) {
continue;
}
if (!users.containsKey(u)) {
UserInfo userInfo = new UserInfo(u, null, null);
userInfo.avatar = UserAvatarResolver.resolve(u, iconSize);
synchronized (this) {
users.put(u, new UserInfo(u, null, null));
users.put(u, userInfo);
modified.add(u);
}
}
@@ -833,7 +842,7 @@ public AsynchPeople(View parent) {
accumulate("id", u.getId()).
accumulate("fullName", u.getFullName()).
accumulate("url", u.getUrl()).
accumulate("avatar", UserAvatarResolver.resolve(u, iconSize)).
accumulate("avatar", i.avatar).
accumulate("timeSortKey", i.getTimeSortKey()).
accumulate("lastChangeTimeString", i.getLastChangeTimeString());
AbstractProject<?,?> p = i.getProject();

0 comments on commit bd03abb

Please sign in to comment.