This commit is contained in:
1
cache/cache.py
vendored
1
cache/cache.py
vendored
@@ -318,6 +318,7 @@ async def get_cached_follower_authors(author_id: int):
|
|||||||
logger.debug(f"[get_cached_follower_authors] Cache HIT for {cache_key}: {len(authors_ids)} authors")
|
logger.debug(f"[get_cached_follower_authors] Cache HIT for {cache_key}: {len(authors_ids)} authors")
|
||||||
else:
|
else:
|
||||||
logger.debug(f"[get_cached_follower_authors] Cache MISS for {cache_key}, querying DB")
|
logger.debug(f"[get_cached_follower_authors] Cache MISS for {cache_key}, querying DB")
|
||||||
|
logger.info("[get_cached_follower_authors] Cache MISS - this should happen after follow/unfollow operations")
|
||||||
# Query authors from database
|
# Query authors from database
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
authors_ids = [
|
authors_ids = [
|
||||||
|
|||||||
@@ -129,6 +129,11 @@ async def follow(
|
|||||||
logger.debug("Обновление кэша сущности")
|
logger.debug("Обновление кэша сущности")
|
||||||
await cache_method(entity_dict)
|
await cache_method(entity_dict)
|
||||||
|
|
||||||
|
# Инвалидируем кэш подписок пользователя для обновления списка подписок
|
||||||
|
cache_key_pattern = f"author:follows-{entity_type}s:{follower_id}"
|
||||||
|
await redis.execute("DEL", cache_key_pattern)
|
||||||
|
logger.debug(f"Инвалидирован кэш подписок: {cache_key_pattern}")
|
||||||
|
|
||||||
if what == "AUTHOR" and not existing_sub:
|
if what == "AUTHOR" and not existing_sub:
|
||||||
logger.debug("Отправка уведомления автору о подписке")
|
logger.debug("Отправка уведомления автору о подписке")
|
||||||
if isinstance(follower_dict, dict) and isinstance(entity_id, int):
|
if isinstance(follower_dict, dict) and isinstance(entity_id, int):
|
||||||
|
|||||||
Reference in New Issue
Block a user