[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2020 18:21:44 +0100
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 17:26:46 +0000
  • Ironport-sdr: XLsqIzKr+LbHvXDHYGeXcxiwqJmXkCGLhWZc6reQ6QXPuqklIpvyACl3ovNfEqdFwoW+SRnBkN bFwoJYEmB+cFYC4gX3Jpu9p5RSbA4UVnpAvmGbfqf6bfScRb8HbTlPQosR2n6RH3AcEvbpsCtG Ec9GdzWVQ2zoEKMrB7QOXNMb1CV2q5WhLElXBQhbaFjHsgBNAatTvE9fS23uXQ8WUN8rSkS3sU dYSjcztV/qKTW/XNImmVgECkcHLkUOUMaf5MpQYsQW9qHGwpwIAacsHf2y73t2xa68glEoUqYi BCk=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxxxxx>
---
 Osstest/HistoryReport.pm | 1 +
 1 file changed, 1 insertion(+)

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}++;
-- 
2.11.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.