Prep work.

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 sg-report-host-history | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/sg-report-host-history b/sg-report-host-history
index a8dae159..2724ef27 100755
--- a/sg-report-host-history
+++ b/sg-report-host-history
@@ -112,6 +112,16 @@ sub cache_read_existing ($) {
     close H;
 }
 
+sub cache_row_lookup_prep ($) {
+    my ($jrr) = @_;
+
+    my $cacherow = $cache{cache_row_key($$jrr)};
+    if ($cacherow) {
+       $$jrr = $cacherow;
+       $cachehits++;
+    }
+}
+
 sub cache_write_entry ($$) {
     my ($fh, $jr) = @_;
     print $fh "<!-- osstest-report-reuseable";
@@ -286,11 +296,7 @@ END
     foreach my $jr (@$inrows) {
        #print DEBUG "JOB $jr->{flight}.$jr->{job} ";
 
-       my $cacherow = $cache{cache_row_key($jr)};
-       if ($cacherow) {
-           $jr = $cacherow;
-           $cachehits++;
-       }
+       cache_row_lookup_prep(\$jr);
 
        my $endedrow = cacheable_query($endedq, $jr, 'e');
        if (!$endedrow) {
-- 
2.11.0


Reply via email to