|
@@ -127,6 +127,14 @@ def trend():
|
|
|
|
|
|
try:
|
|
|
page = CachedLoadingPage(template("loading", progress=[]))
|
|
|
+ for k in [k for k, v in CACHE.items() if v.stale]:
|
|
|
+ del CACHE[k]
|
|
|
+
|
|
|
+ for idx, (_, k) in enumerate(sorted([
|
|
|
+ (v.age, k) for k, v in CACHE.items()
|
|
|
+ ])):
|
|
|
+ if idx > 10: del CACHE[k]
|
|
|
+
|
|
|
CACHE[request.query_string] = page
|
|
|
thread = Thread(target=worker.trend, args=(page.queue, conn, path, request.query))
|
|
|
thread.start()
|