Don't show how long a machine has been idle

Without an index on (machine, stoptime desc), this requires a
sequential scan. And adding a whole index for this seems
overkill. (Possibly the queue runner could maintain this info more
efficiently.)
This commit is contained in:
Eelco Dolstra 2015-07-10 15:34:29 +02:00
parent 3bb9e17e5c
commit 5919e911db
2 changed files with 1 additions and 13 deletions

View file

@ -111,14 +111,6 @@ sub machines :Local Args(0) {
# Add entry for localhost. # Add entry for localhost.
${$machines}{''} //= {}; ${$machines}{''} //= {};
# Get the last finished build step for each machine.
foreach my $m (keys %{$machines}) {
my $idle = $c->model('DB::BuildSteps')->find(
{ machine => "$m", stoptime => { '!=', undef } },
{ order_by => 'stoptime desc', rows => 1 });
${$machines}{$m}{'idle'} = $idle ? $idle->stoptime : 0;
}
$c->stash->{machines} = $machines; $c->stash->{machines} = $machines;
$c->stash->{steps} = [ $c->model('DB::BuildSteps')->search( $c->stash->{steps} = [ $c->model('DB::BuildSteps')->search(
{ finished => 0, 'me.busy' => 1, 'build.busy' => 1, }, { finished => 0, 'me.busy' => 1, 'build.busy' => 1, },

View file

@ -41,11 +41,7 @@
[% END %] [% END %]
[% END %] [% END %]
[% IF idle == 1 %] [% IF idle == 1 %]
[% IF m.value.idle %] <tr><td colspan="6">Idle</td></tr>
<tr><td colspan="6">Idle for [% INCLUDE renderDuration duration = curTime - m.value.idle %]</td></tr>
[% ELSE %]
<tr><td colspan="6">Never used</td></tr>
[% END %]
[% END %] [% END %]
</tbody> </tbody>
[% END %] [% END %]