From: Ian Jackson Date: Fri, 24 Jul 2020 15:50:07 +0000 (+0100) Subject: sg-report-host-history: Rerganisation: Make mainquery per-host X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b969931d304900ccf95dd29cc518a611c206c74a;p=osstest.git 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 --- diff --git a/sg-report-host-history b/sg-report-host-history index 15866ab..34216aa 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(<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 ($) { @@ -474,7 +475,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) {