From 5919e911db24baa60fc339fd91b84a21a6a570ce Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 10 Jul 2015 15:34:29 +0200 Subject: [PATCH] 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.) --- src/lib/Hydra/Controller/Root.pm | 8 -------- src/root/machine-status.tt | 6 +----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index f921ff9e..ff329c39 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -111,14 +111,6 @@ sub machines :Local Args(0) { # Add entry for localhost. ${$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->{steps} = [ $c->model('DB::BuildSteps')->search( { finished => 0, 'me.busy' => 1, 'build.busy' => 1, }, diff --git a/src/root/machine-status.tt b/src/root/machine-status.tt index 5847c970..64290d36 100644 --- a/src/root/machine-status.tt +++ b/src/root/machine-status.tt @@ -41,11 +41,7 @@ [% END %] [% END %] [% IF idle == 1 %] - [% IF m.value.idle %] - Idle for [% INCLUDE renderDuration duration = curTime - m.value.idle %] - [% ELSE %] - Never used - [% END %] + Idle [% END %] [% END %]