Unverified Commit cba50273 authored by Cody Yu's avatar Cody Yu Committed by GitHub
Browse files

Fix BaseCache metric (#170)

parent a6aa46dd
...@@ -24,7 +24,6 @@ class BaseCache: ...@@ -24,7 +24,6 @@ class BaseCache:
self.metrics["avg_init_time"] = (init_time / new_total) + ( self.metrics["avg_init_time"] = (init_time / new_total) + (
curr_total / new_total curr_total / new_total
) * self.metrics["avg_init_time"] ) * self.metrics["avg_init_time"]
self.metrics["total"] += 1
return val return val
if key in self.cache: if key in self.cache:
...@@ -35,6 +34,7 @@ class BaseCache: ...@@ -35,6 +34,7 @@ class BaseCache:
val = _init_with_timer(key) val = _init_with_timer(key)
if self.enable: if self.enable:
self.metrics["total"] += 1
self.cache[key] = val self.cache[key] = val
return val return val
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment