[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 07/11] sg-report-host-history: Rerganisation: Make mainquery per-host
This moves the loop over hosts into the main program. We are working our way to a new code structure. No functional change. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- sg-report-host-history | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/sg-report-host-history b/sg-report-host-history index ab88828e..509d053d 100755 --- a/sg-report-host-history +++ b/sg-report-host-history @@ -164,7 +164,9 @@ sub jobquery ($$$) { our %hosts; -sub mainquery () { +sub mainquery ($) { + my ($host) = @_; + our $runvarq //= db_prepare(<<END); SELECT flight, job, name, status FROM runvars @@ -177,13 +179,12 @@ sub mainquery () { ORDER BY flight DESC LIMIT $limit * 2 END - foreach my $host (sort keys %hosts) { - print DEBUG "MAINQUERY $host...\n"; - $runvarq->execute($host, $minflight); - $hosts{$host} = $runvarq->fetchall_arrayref({}); - print DEBUG "MAINQUERY $host got ".(scalar @{ $hosts{$host} })."\n"; - } + print DEBUG "MAINQUERY $host...\n"; + $runvarq->execute($host, $minflight); + + $hosts{$host} = $runvarq->fetchall_arrayref({}); + print DEBUG "MAINQUERY $host got ".(scalar @{ $hosts{$host} })."\n"; } sub reporthost ($) { @@ -473,7 +474,9 @@ db_retry($dbh_tests, [], sub { }); db_retry($dbh_tests, [], sub { - mainquery(); + foreach my $host (sort keys %hosts) { + mainquery($host); + } }); foreach my $host (sort keys %hosts) { -- 2.20.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |