diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index 2ae2f08c9..d64c0331b 100644 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -324,7 +324,7 @@ class HotController(FixListing, ListingController): return normalized_hot(sr_ids) elif isinstance(c.site, MultiReddit): - return normalized_hot(c.site.kept_sr_ids) + return normalized_hot(c.site.kept_sr_ids, obey_age_limit=False) #if not using the query_cache we still want cached front pages elif (not g.use_query_cache diff --git a/r2/r2/lib/_normalized_hot.pyx b/r2/r2/lib/_normalized_hot.pyx index f68efc750..4d315af12 100644 --- a/r2/r2/lib/_normalized_hot.pyx +++ b/r2/r2/lib/_normalized_hot.pyx @@ -31,12 +31,14 @@ from time import time max_items = 150 # the number of links to request from the hot page # query when the precomputer is disabled -cpdef list get_hot(list srs, only_fullnames = True): +cpdef list get_hot(list srs, only_fullnames=True, obey_age_limit=True): """Get the fullnames for the hottest normalised hottest links in a subreddit. Use the query-cache to avoid some lookups if we can.""" cdef double oldest - cdef int hot_page_age = g.HOT_PAGE_AGE + cdef int hot_page_age = 0 + if obey_age_limit: + hot_page_age = g.HOT_PAGE_AGE cdef int i cdef double hot cdef double thot # the top hotness on a given subreddit @@ -109,8 +111,8 @@ cpdef _second(tuple x): return x[2] # memoized by our caller in normalized_hot.py -cpdef list normalized_hot_cached(sr_ids): +cpdef list normalized_hot_cached(sr_ids, obey_age_limit=True): """Fetches the hot lists for each subreddit, normalizes the scores, and interleaves the results.""" - srs = Subreddit._byID(sr_ids, return_dict = False) - return get_hot(srs, True) + srs = Subreddit._byID(sr_ids, return_dict=False) + return get_hot(srs, True, obey_age_limit) diff --git a/r2/r2/lib/normalized_hot.py b/r2/r2/lib/normalized_hot.py index b62d8db5d..359d36ca7 100644 --- a/r2/r2/lib/normalized_hot.py +++ b/r2/r2/lib/normalized_hot.py @@ -6,8 +6,8 @@ from r2.lib import _normalized_hot from r2.lib._normalized_hot import get_hot # pull this into our namespace @memoize('normalize_hot', time = g.page_cache_time) -def normalized_hot_cached(sr_ids): - return _normalized_hot.normalized_hot_cached(sr_ids) +def normalized_hot_cached(sr_ids, obey_age_limit=True): + return _normalized_hot.normalized_hot_cached(sr_ids, obey_age_limit) def l(li): if isinstance(li, list): @@ -15,6 +15,6 @@ def l(li): else: return list(li) -def normalized_hot(sr_ids): +def normalized_hot(sr_ids, obey_age_limit=True): sr_ids = l(sorted(sr_ids)) - return normalized_hot_cached(sr_ids) if sr_ids else () + return normalized_hot_cached(sr_ids, obey_age_limit) if sr_ids else ()