Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-15583]
Report 100 recent builds in the JSON API, including in-progress builds.

Not reporting all the builds since this would nullify the lazy loading
effect. Will introduce a pagenation API that supports retrieval.
  • Loading branch information
kohsuke committed Mar 13, 2013
1 parent c7ad5e9 commit fe9f676
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
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>
an in-progress build was dropped from JSON API when lazy-loading was introduced.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15583">issue 15583</a>)
<li class=bug>
Fixed a bad interaction between Windows symlinks and build record lazy loading.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15587">issue 15587</a>)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Job.java
Expand Up @@ -612,7 +612,7 @@ public RunList<RunT> getBuilds() {
*/
@Exported(name="builds")
public RunList<RunT> getNewBuilds() {
return getBuilds().newBuilds();
return getBuilds().limit(100);

This comment has been minimized.

Copy link
@jglick

jglick Mar 13, 2013

Member

Even 100 seems like possibly too many; I was just looking at someone’s thread dump recently and it showed lots of activity servicing the recent build list, even though they were probably not even using this information. Ideally everyone would start using tree to pick out what they actually want, but in the meantime is it incompatible to lower the visibility of expensive things like this?

}

/**
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/java/hudson/util/RunList.java
Expand Up @@ -221,6 +221,14 @@ public String toString() {
return this;
}

public RunList<R> limit(final int n) {

This comment has been minimized.

Copy link
@jglick

jglick Mar 13, 2013

Member

@since

return limit(new CountingPredicate<R>() {
public boolean apply(int index, R input) {
return index<n;
}
});
}

/**
* Filter the list to non-successful builds only.
*/
Expand Down

0 comments on commit fe9f676

Please sign in to comment.