From 10248ffd8c1f8bad284449ad3ff1d90bb82f3acf Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 29 Feb 2024 10:31:49 +0300 Subject: [PATCH] debug-followers-cache --- CHANGELOG.txt | 1 + resolvers/author.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1af4856a..e77fb783 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,6 @@ [0.3.2] - redis cache for what author follows +- redis cache for followers - graphql add query: get topic followers [0.3.1] diff --git a/resolvers/author.py b/resolvers/author.py index e2b25dac..168ee9b1 100644 --- a/resolvers/author.py +++ b/resolvers/author.py @@ -244,7 +244,11 @@ async def get_author_followers(_, _info, slug: str): ) results = get_with_stat(q) _ = asyncio.create_task(update_author_followers_cache(author_id, results)) - return json.loads(cached) if cached else results + logger.debug(f'@{slug} cache updated with {len(results)} followers') + return results + else: + logger.debug(f'@{slug} got followers cached today') + return json.loads(cached) except Exception as exc: import traceback logger.error(exc)