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

@@ -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: