Skip to content
Browse files
[FIXED JENKINS-31487] (#2542)
There were two issues preventing the build history from updating properly:
1) The next build number being fetched wasn't taking into account running builds, so any builds already running when the page is refreshed would be ignored. The fix was to use nextBuildNumberToFetch if it is available (which is the case if there are running builds) and to fall back to the next build otherwise.
2) The first transient build key (used to clear out builds from the history that are being updated) wasn't being set when the page first loads. This was fixed by making getHistoryPageFilter calculate the value so that it happens in all cases rather than just during the ajax call.
  • Loading branch information
matthewreiter authored and daniel-beck committed Sep 18, 2016
1 parent fbb4dc0 commit 0268b988d5c88cd29be12ed25e95d5bc448c2840
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
@@ -77,6 +77,6 @@ public HistoryPageFilter getHistoryPageFilter() {
historyPageFilter.add(baseList, getQueuedItems());
historyPageFilter.widget = this;

return historyPageFilter;
return updateFirstTransientBuildKey(historyPageFilter);
@@ -114,6 +114,20 @@ public String getFirstTransientBuildKey() {
return firstTransientBuildKey;

* Calculates the first transient build record. Everything >= this will be discarded when AJAX call is made.
* @param historyPageFilter
* The history page filter containing the list of builds.
* @return
* The history page filter that was passed in.
protected HistoryPageFilter updateFirstTransientBuildKey(HistoryPageFilter historyPageFilter) {
return historyPageFilter;

private Iterable<HistoryPageEntry<T>> updateFirstTransientBuildKey(Iterable<HistoryPageEntry<T>> source) {
String key=null;
for (HistoryPageEntry<T> t : source) {
@@ -166,7 +180,7 @@ public HistoryPageFilter getHistoryPageFilter() {

historyPageFilter.widget = this;
return historyPageFilter;
return updateFirstTransientBuildKey(historyPageFilter);

protected HistoryPageFilter<T> newPageFilter() {
@@ -238,7 +252,6 @@ public void doAjax( StaplerRequest req, StaplerResponse rsp,

HistoryPageFilter page = getHistoryPageFilter();

@@ -119,6 +119,6 @@ THE SOFTWARE.
<script defer="true">
updateBuildHistory("${it.baseUrl}/buildHistory/ajax", ${it.nextBuildNumberToFetch ?: it.owner.nextBuildNumber});

0 comments on commit 0268b98

Please sign in to comment.