nocacheshout
Some checks failed
Deploy on push / deploy (push) Failing after 9s

This commit is contained in:
Untone 2024-08-07 08:22:08 +03:00
parent df25eaf905
commit b358a6f4a9

View File

@ -4,7 +4,7 @@ from orm.author import Author, AuthorFollower
from orm.reaction import Reaction from orm.reaction import Reaction
from orm.shout import Shout, ShoutAuthor from orm.shout import Shout, ShoutAuthor
from orm.topic import Topic, TopicFollower from orm.topic import Topic, TopicFollower
from services.cache import cache_author, get_cached_author, cache_topic, get_cached_shout, get_cached_topic, cache_shout from services.cache import cache_author, get_cached_author, cache_topic, get_cached_topic
from services.logger import root_logger as logger from services.logger import root_logger as logger
@ -12,7 +12,7 @@ class CacheRevalidationManager:
"""Управление периодической ревалидацией кэша.""" """Управление периодической ревалидацией кэша."""
def __init__(self): def __init__(self):
self.items_to_revalidate = {"authors": set(), "topics": set(), "shouts": set()} self.items_to_revalidate = {"authors": set(), "topics": set()}
self.revalidation_interval = 60 # Интервал ревалидации в секундах self.revalidation_interval = 60 # Интервал ревалидации в секундах
async def revalidate_cache(self): async def revalidate_cache(self):
@ -35,11 +35,6 @@ class CacheRevalidationManager:
topic = await get_cached_topic(entity_id) topic = await get_cached_topic(entity_id)
if topic: if topic:
await cache_topic(topic) await cache_topic(topic)
elif entity_type == "shouts":
# Ревалидация кэша shout
shout = await get_cached_shout(entity_id)
if shout:
await cache_shout(shout)
ids.clear() ids.clear()
def mark_for_revalidation(self, entity_id, entity_type): def mark_for_revalidation(self, entity_id, entity_type):