Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-18861] fixed so that it does not load useless build.
.
  • Loading branch information
ssogabe committed Aug 12, 2013
1 parent 0b02809 commit ec0a531
Showing 1 changed file with 14 additions and 7 deletions.
Expand Up @@ -46,7 +46,7 @@ public String getTimestampString(Run run) {
*
*/
public List<Run> getFinishedBuilds() {
List<Job> jobs = getDashboard().getJobs();
List<Job> jobs = getDashboardJobs();

PriorityQueue<Run> queue = new PriorityQueue<Run>(numBuilds, Run.ORDER_BY_DATE);
for (Job job : jobs) {
Expand All @@ -57,21 +57,28 @@ public List<Run> getFinishedBuilds() {
}

List<Run> recentBuilds = new ArrayList<Run>(numBuilds);
for (int i = 0; i < numBuilds; i++) {
Run run = queue.poll();
if (run == null) {
Run build;
while ((build = queue.poll()) != null) {
recentBuilds.add(build);
if (recentBuilds.size() == numBuilds) {
break;
}
recentBuilds.add(run);
Run pb = run.getPreviousBuild();
Run pb = build.getPreviousBuild();
if (pb != null) {
queue.add(pb);
}
}

return recentBuilds;
}

/**
* for unit test
*/
protected List<Job> getDashboardJobs() {
return getDashboard().getJobs();
}

public String getBuildColumnSortData(Run<?, ?> build) {
return String.valueOf(build.getNumber());
}
Expand Down

0 comments on commit ec0a531

Please sign in to comment.