followers-cache-debug
All checks were successful
Deploy on push / deploy (push) Successful in 26s

This commit is contained in:
Untone 2024-05-06 12:41:53 +03:00
parent c46f264c4b
commit 5caa2d1f8c

View File

@ -308,12 +308,12 @@ async def get_author_followers(_, _info, slug: str):
author_id = author.id
cached = await redis.execute("GET", f"author:{author_id}:followers")
if cached:
logger.debug(f"@{slug} got followers cached")
followers_ids = []
followers = []
if isinstance(cached, str):
followers_cached = json.loads(cached)
if isinstance(followers_cached, list):
logger.debug(f"@{slug} got {len(followers_cached)} followers cached")
for fc in followers_cached:
if fc['id'] not in followers_ids:
followers.append(fc)