debug-followers-cache

This commit is contained in:
Untone 2024-02-29 10:31:49 +03:00
parent f774c54cc2
commit 10248ffd8c
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,6 @@
[0.3.2] [0.3.2]
- redis cache for what author follows - redis cache for what author follows
- redis cache for followers
- graphql add query: get topic followers - graphql add query: get topic followers
[0.3.1] [0.3.1]

View File

@ -244,7 +244,11 @@ async def get_author_followers(_, _info, slug: str):
) )
results = get_with_stat(q) results = get_with_stat(q)
_ = asyncio.create_task(update_author_followers_cache(author_id, results)) _ = 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: except Exception as exc:
import traceback import traceback
logger.error(exc) logger.error(exc)