diff mbox series

[OSSTEST,41/60] sg-report-job-history (nfc): Make $ri->{Hosts} a hash

Message ID 20200814172205.9624-42-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up sg-report-job-history | expand

Commit Message

Ian Jackson Aug. 14, 2020, 5:21 p.m. UTC
This will make it easier to cache this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 sg-report-job-history | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/sg-report-job-history b/sg-report-job-history
index 8932458e..118926c6 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -173,11 +173,11 @@  END
     while (my $f= $flightsq->fetchrow_hashref()) {
         my $ri= report_run_getinfo($f);
 
-	$ri->{Hosts} = [ ];
+	$ri->{Hosts} = { };
 	foreach my $hostvar (@hostvarcols) {
 	    $hostq->execute($f->{flight}, $f->{job}, $hostvar);
 	    my ($host) = $hostq->fetchrow_array();
-	    push @{ $ri->{Hosts} }, ($host // "-");
+	    $ri->{Hosts}{$hostvar} = $host;
 	}
 
         my %revisions;
@@ -255,7 +255,7 @@  END
 	print H "<td $r->{ColourAttr}><a href=\"$url\">".
 	    $r->{Content}."</a></td>\n";
 	my $lastrev;
-	my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} };
+	my $hosts = join ", ", map { $r->{Hosts}{$_} // "-" } @hostvarcols;
 	my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts);
 	print H "<td $hosts_colour>".encode_entities($hosts)."</td>\n";
 	$osstestverq->execute($r->{Flight}{flight});