Re-enable the "Related Builds" tab

However, there is a "limit 1" on the JobsetEval search to prevent a
sequential scan of the Builds table.
This commit is contained in:
Eelco Dolstra 2012-03-12 20:14:42 +01:00
parent abe71a767b
commit 27619f18e2

View file

@ -80,13 +80,13 @@ sub view_build : Chained('build') PathPart('') Args(0) {
];
}
#my $r = joinWithResultInfo( $c, $c->model('DB::Builds'))->search(
# { eval => { -in => $build->jobsetevalmembers->all->get_column('eval')->as_query } }
# , { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'], distinct => 1 }
# );
#if ($r->count <= 100) {
# $c->stash->{relatedbuilds} = [$r->all];
#}
my $maxRelated = 100;
my $r = $c->model('DB::Builds')->search(
{ eval => { -in => $build->jobsetevalmembers->search({}, {rows => 1})->get_column('eval')->as_query } },
{ join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'], distinct => 1, rows => $maxRelated + 1 }
);
$c->stash->{relatedbuilds} = [$r->all];
delete $c->stash->{relatedbuilds} if scalar(@{$c->stash->{relatedbuilds}}) > $maxRelated;
}