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) {
$c->stash->{prevBuilds} = [$c->model('DB::Builds')->search(
{ project => $c->stash->{project}->name
, jobset => $c->stash->{jobset}->name
{ jobset_id => $c->stash->{jobset}->id
, job => $c->stash->{job}
, 'me.system' => $build->system
, finished => 1

View file

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

View file

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

View file

@ -426,7 +426,7 @@ sub checkBuild {
# semantically unnecessary (because they're implied by
# the eval), but they give a factor 1000 speedup on
# 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 },
{ rows => 1, columns => ['id'], join => ['buildoutputs'] });
if (defined $prevBuild) {