topviewed-removed-queries-fixes

This commit is contained in:
2022-09-20 10:11:22 +03:00
parent a67725a634
commit e41856dbc3
4 changed files with 44 additions and 58 deletions

View File

@@ -52,7 +52,6 @@ from resolvers.zine import (
recent_all,
recent_commented,
recent_reacted,
top_viewed,
shouts_by_authors,
shouts_by_topics,
shouts_by_communities,
@@ -84,7 +83,6 @@ __all__ = [
"get_user_reacted_shouts",
"top_month",
"top_overall",
"top_viewed",
"increment_view",
"get_shout_by_slug",
# editor

View File

@@ -18,16 +18,11 @@ from services.zine.shoutscache import ShoutsCache
@mutation.field("incrementView")
async def increment_view(_, _info, shout):
# TODO: use ackee to collect views
async with ViewedStorage.lock:
return ViewedStorage.increment(shout)
@query.field("topViewed")
async def top_viewed(_, _info, offset, limit):
async with ShoutsCache.lock:
return ShoutsCache.top_viewed[offset : offset + limit]
@query.field("topMonth")
async def top_month(_, _info, offset, limit):
async with ShoutsCache.lock: