From f6b21174bf8be80c08f5a02dfbf22bb68d321238 Mon Sep 17 00:00:00 2001 From: Untone Date: Mon, 6 May 2024 11:27:15 +0300 Subject: [PATCH] unique-fix-2 --- resolvers/author.py | 3 +-- services/cache.py | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/resolvers/author.py b/resolvers/author.py index 8ad15822..771e3de9 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -325,8 +325,7 @@ async def get_author_followers(_, _info, slug: str): else: logger.debug(f"@{slug} got followers cached") if isinstance(cached, str): - data = json.loads(cached) - return [dict(d) for d in set(tuple(d.items()) for d in data)] + return json.loads(cached) except Exception as exc: import traceback diff --git a/services/cache.py b/services/cache.py index 4475bfbb..5ef17221 100644 --- a/services/cache.py +++ b/services/cache.py @@ -112,7 +112,10 @@ async def cache_follower(follower: dict, author: dict, is_insert=True): else: followers = [e for e in followers if int(e["id"]) != author_id] - followers = [dict(d) for d in set(tuple(d.items()) for d in followers)] + followers = [ + dict(d) + for d in set(tuple(tuple(k, v) for k, v in d.items()) for d in followers) + ] author_str = await redis.execute("GET", f"author:{follower_id}") if isinstance(author_str, str):