From 709dd352613ea6c998bbbaf45bb616681cb77ace Mon Sep 17 00:00:00 2001 From: Logan Hanks Date: Wed, 16 Nov 2011 12:19:34 -0800 Subject: [PATCH] Fix bug counting misses in chains with no permanent caches. --- r2/r2/lib/cache.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/r2/r2/lib/cache.py b/r2/r2/lib/cache.py index 52831b730..289f6fc38 100644 --- a/r2/r2/lib/cache.py +++ b/r2/r2/lib/cache.py @@ -439,6 +439,10 @@ class CacheChain(CacheUtils, local): if v != NoneResult) if self.stats: + if not misses: + # If this chain contains no permanent caches, then we need to + # count the misses here. + misses = len(need) self.stats.cache_hit(hits) self.stats.cache_miss(misses)