Fix a huge performance regression in the jobstatus page
The renderBuildStatusIcon function was looking at the resultInfo and schedulingInfo of each build, causing a SQL query for every build in the result.
This commit is contained in:
@ -25,11 +25,16 @@ sub overview : Chained('job') PathPart('') Args(0) {
|
||||
|
||||
#getBuildStats($c, scalar $c->stash->{job}->builds);
|
||||
|
||||
$c->stash->{currentBuilds} = [$c->stash->{job}->builds->search({iscurrent => 1}, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
|
||||
, '+as' => ["releasename", "buildstatus"], order_by => 'system' })];
|
||||
$c->stash->{currentBuilds} = [$c->stash->{job}->builds->search({iscurrent => 1}, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildStatus"]
|
||||
, '+as' => ["releasename", "buildStatus"], order_by => 'system' })];
|
||||
|
||||
$c->stash->{lastBuilds} = [$c->stash->{job}->builds->search({ finished => 1 }, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
|
||||
, '+as' => ["releasename", "buildstatus"], order_by => 'timestamp DESC', rows => 10 })];
|
||||
$c->stash->{lastBuilds} =
|
||||
[ $c->stash->{job}->builds->search({ finished => 1 },
|
||||
{ join => 'resultInfo',
|
||||
, '+select' => ["resultInfo.releasename", "resultInfo.buildStatus"]
|
||||
, '+as' => ["releasename", "buildStatus"]
|
||||
, order_by => 'timestamp DESC', rows => 10
|
||||
}) ];
|
||||
|
||||
$c->stash->{runningBuilds} = [$c->stash->{job}->builds->search({busy => 1}, { join => ['schedulingInfo', 'project'] , order_by => ["priority DESC", "timestamp"]
|
||||
, '+select' => ['project.enabled', 'schedulingInfo.priority', 'schedulingInfo.disabled', 'schedulingInfo.busy']
|
||||
|
@ -82,7 +82,11 @@ sub jobsetIndex {
|
||||
# Last builds for jobset.
|
||||
my $tmp = $c->stash->{jobset}->builds;
|
||||
$c->stash->{lastBuilds} =
|
||||
[ joinWithResultInfo($c, $tmp)->search({ finished => 1 }, { order_by => "timestamp DESC", rows => 5 }) ];
|
||||
[ joinWithResultInfo($c, $tmp)->search({ finished => 1 },
|
||||
{ order_by => "timestamp DESC", rows => 5
|
||||
, '+select' => ["resultInfo.buildStatus"]
|
||||
, '+as' => ["buildStatus"]
|
||||
}) ];
|
||||
}
|
||||
|
||||
sub index : Chained('jobset') PathPart('') Args(0) {
|
||||
|
Reference in New Issue
Block a user