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.
  • Loading branch information
jglick committed Jan 15, 2013
1 parent 1ecafe8 commit c757e65431ad1aec9a3bebe81ac919577e51ac58
Showing with 19 additions and 7 deletions.
  1. +3 −0 changelog.html
  2. +16 −7 core/src/main/java/hudson/model/View.java
@@ -58,6 +58,9 @@
<li class=bug>
Reduced size of memory leak in render-on-demand functionality used e.g. in configuration pages.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16341">issue 16341</a>)
<li class=bug>
Improving responsiveness of <b>People</b> page when using Gravatar plugin.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16342">issue 16342</a>)
<li class=bug>
Improved logging and error output from SSHD in Jenkins.
</ul>
@@ -578,6 +578,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;
@@ -779,12 +782,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);
@@ -809,8 +816,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);
}
}
@@ -826,7 +835,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 c757e65

Please sign in to comment.