Join to builds via jobset_id when easy

This commit is contained in:
Graham Christensen 2021-06-01 11:16:47 -04:00
parent 5b6b8261fc
commit 508d99d611
4 changed files with 5 additions and 9 deletions

View file

@ -83,8 +83,7 @@ sub build_GET {
if ($build->finished) { if ($build->finished) {
$c->stash->{prevBuilds} = [$c->model('DB::Builds')->search( $c->stash->{prevBuilds} = [$c->model('DB::Builds')->search(
{ project => $c->stash->{project}->name { jobset_id => $c->stash->{jobset}->id
, jobset => $c->stash->{jobset}->name
, job => $c->stash->{job} , job => $c->stash->{job}
, 'me.system' => $build->system , 'me.system' => $build->system
, finished => 1 , finished => 1

View file

@ -22,8 +22,7 @@ sub channel : Chained('/') PathPart('channel/custom') CaptureArgs(3) {
my $lastSuccessful = $c->model('DB::Builds')->find( my $lastSuccessful = $c->model('DB::Builds')->find(
{ 'eval.hasnewbuilds' => 1 { 'eval.hasnewbuilds' => 1
, project => $projectName , jobset_id => $c->stash->{jobset}->id,
, jobset => $jobsetName
, job => $channelName , job => $channelName
, buildstatus => 0 , buildstatus => 0
}, },

View file

@ -64,8 +64,7 @@ sub getNextBuild {
(my $nextBuild) = $c->model('DB::Builds')->search( (my $nextBuild) = $c->model('DB::Builds')->search(
{ finished => 1 { finished => 1
, system => $build->system , system => $build->system
, project => $build->get_column('project') , jobset_id => $build->get_column('jobset_id')
, jobset => $build->get_column('jobset')
, job => $build->get_column('job') , job => $build->get_column('job')
, 'me.id' => { '>' => $build->id } , 'me.id' => { '>' => $build->id }
}, {rows => 1, order_by => "me.id ASC"}); }, {rows => 1, order_by => "me.id ASC"});
@ -81,8 +80,7 @@ sub getPreviousSuccessfulBuild {
(my $prevBuild) = $c->model('DB::Builds')->search( (my $prevBuild) = $c->model('DB::Builds')->search(
{ finished => 1 { finished => 1
, system => $build->system , system => $build->system
, project => $build->get_column('project') , jobset_id => $build->get_column('jobset_id')
, jobset => $build->get_column('jobset')
, job => $build->get_column('job') , job => $build->get_column('job')
, buildstatus => 0 , buildstatus => 0
, 'me.id' => { '<' => $build->id } , 'me.id' => { '<' => $build->id }

View file

@ -426,7 +426,7 @@ sub checkBuild {
# semantically unnecessary (because they're implied by # semantically unnecessary (because they're implied by
# the eval), but they give a factor 1000 speedup on # the eval), but they give a factor 1000 speedup on
# the Nixpkgs jobset with PostgreSQL. # the Nixpkgs jobset with PostgreSQL.
{ project => $jobset->get_column('project'), jobset => $jobset->name, job => $jobName, { jobset_id => $jobset->get_column('id'), job => $jobName,
name => $firstOutputName, path => $firstOutputPath }, name => $firstOutputName, path => $firstOutputPath },
{ rows => 1, columns => ['id'], join => ['buildoutputs'] }); { rows => 1, columns => ['id'], join => ['buildoutputs'] });
if (defined $prevBuild) { if (defined $prevBuild) {