提交 c757e654 编写于 作者: J Jesse Glick

[JENKINS-16342] Improving responsiveness of asynchPeople when Gravatar 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.
上级 1ecafe8a
......@@ -58,6 +58,9 @@ Upcoming changes</a>
<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 abstract class View extends AbstractModelObject implements AccessControll
*/
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 abstract class View extends AbstractModelObject implements AccessControll
}
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 abstract class View extends AbstractModelObject implements AccessControll
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 abstract class View extends AbstractModelObject implements AccessControll
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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册