Make "Running builds" and "Machine status" pages faster
This commit is contained in:
@ -45,7 +45,7 @@ sub begin :Private {
|
||||
}
|
||||
|
||||
if (scalar(@args) == 0 || $args[0] ne "static") {
|
||||
$c->stash->{nrRunningBuilds} = $c->model('DB')->schema->storage->dbh->selectrow_array(
|
||||
$c->stash->{nrRunningBuilds} = dbh($c)->selectrow_array(
|
||||
"select count(distinct build) from buildsteps where busy = 1");
|
||||
$c->stash->{nrQueuedBuilds} = $c->model('DB::Builds')->search({ finished => 0 })->count();
|
||||
}
|
||||
@ -105,7 +105,7 @@ sub queue_summary :Local :Path('queue-summary') :Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
$c->stash->{template} = 'queue-summary.tt';
|
||||
|
||||
$c->stash->{queued} = $c->model('DB')->schema->storage->dbh->selectall_arrayref(
|
||||
$c->stash->{queued} = dbh($c)->selectall_arrayref(
|
||||
"select project, jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " .
|
||||
"where finished = 0 group by project, jobset order by queued desc",
|
||||
{ Slice => {} });
|
||||
@ -119,7 +119,7 @@ sub status_GET {
|
||||
$self->status_ok(
|
||||
$c,
|
||||
entity => [$c->model('DB::Builds')->search(
|
||||
{ finished => 0, "buildsteps.busy" => 1 },
|
||||
{ "buildsteps.busy" => 1 },
|
||||
{ order_by => ["globalpriority DESC", "id"],
|
||||
join => "buildsteps",
|
||||
columns => [@buildListColumns]
|
||||
@ -164,11 +164,11 @@ sub machines :Local Args(0) {
|
||||
}
|
||||
|
||||
$c->stash->{machines} = $machines;
|
||||
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
|
||||
{ finished => 0, 'me.busy' => 1, },
|
||||
{ join => [ 'build' ]
|
||||
, order_by => [ 'machine', 'stepnr' ]
|
||||
} ) ];
|
||||
$c->stash->{steps} = dbh($c)->selectall_arrayref(
|
||||
"select build, stepnr, s.system as system, s.drvpath as drvpath, machine, s.starttime as starttime, project, jobset, job " .
|
||||
"from BuildSteps s join Builds b on s.build = b.id " .
|
||||
"where busy = 1 order by machine, stepnr",
|
||||
{ Slice => {} });
|
||||
$c->stash->{template} = 'machine-status.tt';
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user