mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-26 07:19:25 -05:00
Access CacheStats from Thing._byID more safely.
This commit is contained in:
@@ -352,13 +352,15 @@ class DataThing(object):
|
||||
stale=False):
|
||||
ids, single = tup(ids, True)
|
||||
prefix = thing_prefix(cls.__name__)
|
||||
cache_stats = stats.CacheStats(g.stats, 'sgm.%s' % cls.__name__)
|
||||
|
||||
if not all(x <= tdb.MAX_THING_ID for x in ids):
|
||||
raise NotFound('huge thing_id in %r' % ids)
|
||||
|
||||
def count_found(ret, still_need):
|
||||
cache_stats.cache_report(hits=len(ret), misses=len(still_need))
|
||||
cache.stats.cache_report(hits=len(ret), misses=len(still_need))
|
||||
|
||||
if not cache.stats:
|
||||
count_found = None
|
||||
|
||||
def items_db(ids):
|
||||
items = cls._get_item(cls._type_id, ids)
|
||||
|
||||
Reference in New Issue
Block a user