* Big speed-up of the job status page and the channel generation (such

as the manifest).  The builds are now determined in one SQL query
  rather than a zillion ones.
This commit is contained in:
Eelco Dolstra
2009-04-03 15:37:21 +00:00
parent ca11aba074
commit 16a84f4bf5
10 changed files with 60 additions and 41 deletions

View File

@ -10,9 +10,8 @@ use Hydra::Helper::CatalystUtils;
sub jobstatus : Chained('get_builds') PathPart Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'jobstatus.tt';
my $jobs = $c->stash->{allJobs};
$c->stash->{latestBuilds} =
getLatestBuilds($c, ref $jobs eq "ARRAY" ? $jobs : scalar $jobs->search({active => 1}), {});
[joinWithResultInfo($c, $c->stash->{jobStatus})->all];
}
@ -33,12 +32,9 @@ sub all : Chained('get_builds') PathPart {
$c->stash->{resultsPerPage} = $resultsPerPage;
$c->stash->{totalBuilds} = $nrBuilds;
$c->stash->{builds} = [$c->stash->{allBuilds}->search(
$c->stash->{builds} = [joinWithResultInfo($c, $c->stash->{allBuilds})->search(
{ finished => 1 },
{ join => 'resultInfo'
, '+select' => ["resultInfo.buildstatus", "resultInfo.releasename"]
, '+as' => ["buildstatus", "releasename"]
, order_by => "timestamp DESC"
{ order_by => "timestamp DESC"
, rows => $resultsPerPage
, page => $page })];
}
@ -49,11 +45,11 @@ sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) {
eval {
if ($channelName eq "latest") {
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-latest";
getChannelData($c, getLatestBuilds($c, scalar $c->stash->{allJobs}->search({active => 1}), {buildStatus => 0}));
getChannelData($c, scalar($c->stash->{latestSucceeded}));
}
elsif ($channelName eq "all") {
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-all";
getChannelData($c, [$c->stash->{allBuilds}->all]);
getChannelData($c, scalar($c->stash->{allBuilds}));
}
else {
error($c, "Unknown channel `$channelName'.");

View File

@ -65,7 +65,7 @@ sub nixexprs : Chained('nix') PathPart('nixexprs.tar.bz2') Args(0) {
sub name {
my ($build) = @_;
return $build->resultInfo->releasename || $build->nixname;
return $build->get_column('releasename') || $build->nixname;
}