work-load-fixes

This commit is contained in:
2022-10-01 13:19:13 +03:00
parent 67b3a5d529
commit 16ee157438
4 changed files with 42 additions and 77 deletions

View File

@@ -244,6 +244,16 @@ class ShoutsCache:
print("[zine.cache] indexed by %d authors " % len(shouts_by_author.keys()))
ShoutsCache.by_author = shouts_by_author
@staticmethod
async def get_by_author(author):
async with ShoutsCache.lock:
return ShoutsCache.by_author.get(author, [])
@staticmethod
async def get_by_topic(topic):
async with ShoutsCache.lock:
return ShoutsCache.by_topic.get(topic, [])
@staticmethod
async def get_top_published_before(daysago, offset, limit):
shouts_by_rating = []