From 27619f18e211e3bae812fdbfe8ba54f34cece40e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 12 Mar 2012 20:14:42 +0100 Subject: [PATCH] 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. --- src/lib/Hydra/Controller/Build.pm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index a7824b0e..78e4b59a 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -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; }