diff mbox series

[OSSTEST,39/60] history reporting (nfc): Make cacheable_fn work without cache

Message ID 20200814172205.9624-40-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 would allow us to use this in call sites without a cache.

I changed my mind about the code that prompted this, but it still
seems plausibly useful, so I'm keeping this commit.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 Osstest/HistoryReport.pm | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/Osstest/HistoryReport.pm b/Osstest/HistoryReport.pm
index 695d744a..5d2c83b7 100644
--- a/Osstest/HistoryReport.pm
+++ b/Osstest/HistoryReport.pm
@@ -99,6 +99,7 @@  sub key ($) {
 
 sub cacheable_fn ($$$) {
     my ($jr, $cachekey, $fn) = @_;
+    return $fn->() if !defined $cachekey;
     $cachekey = '%'.$cachekey;
     my $cached = $jr->{$cachekey};
     $q_count{$cachekey}++;