feat: version 0.9.30 - cache invalidation fixes
🔧 Fixed cache invalidation for featured materials: - Enhanced invalidate_shout_related_cache with featured keys - Fixed set_featured/set_unfeatured functions with async cache invalidation - Materials now correctly appear/disappear from main page on feature/unfeature ✅ Code Quality: Python Standards Compliance - Ruff linting & formatting checks passed - MyPy type checking passed - All functions have proper type hints and docstrings - Tests passing successfully Version bump: 0.9.30
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import asyncio
|
||||
import time
|
||||
import traceback
|
||||
from typing import Any
|
||||
@@ -274,6 +275,11 @@ async def set_featured(session: Session, shout_id: int) -> None:
|
||||
for topic in s.topics:
|
||||
revalidation_manager.mark_for_revalidation(topic.id, "topics")
|
||||
|
||||
# 🔧 Инвалидируем ключи кеша лент для обновления featured статусов
|
||||
from cache.cache import invalidate_shout_related_cache
|
||||
|
||||
await invalidate_shout_related_cache(s, s.created_by)
|
||||
|
||||
logger.info(f"Публикация {shout_id} получила статус featured, кеш помечен для ревалидации")
|
||||
|
||||
|
||||
@@ -303,6 +309,12 @@ def set_unfeatured(session: Session, shout_id: int) -> None:
|
||||
for topic in shout.topics:
|
||||
revalidation_manager.mark_for_revalidation(topic.id, "topics")
|
||||
|
||||
# 🔧 Инвалидируем ключи кеша лент для обновления featured статусов
|
||||
from cache.cache import invalidate_shout_related_cache
|
||||
|
||||
# Используем asyncio.create_task для асинхронного вызова
|
||||
asyncio.create_task(invalidate_shout_related_cache(shout, shout.created_by))
|
||||
|
||||
logger.info(f"Публикация {shout_id} потеряла статус featured, кеш помечен для ревалидации")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user