This commit is contained in:
7
cache/precache.py
vendored
7
cache/precache.py
vendored
@@ -3,11 +3,12 @@ import traceback
|
||||
|
||||
from sqlalchemy import and_, join, select
|
||||
|
||||
from auth.orm import Author, AuthorFollower
|
||||
# Импорт Author, AuthorFollower отложен для избежания циклических импортов
|
||||
from cache.cache import cache_author, cache_topic
|
||||
from orm.shout import Shout, ShoutAuthor, ShoutReactionsFollower, ShoutTopic
|
||||
from orm.topic import Topic, TopicFollower
|
||||
from resolvers.stat import get_with_stat
|
||||
from auth.orm import Author, AuthorFollower
|
||||
from services.db import local_session
|
||||
from services.redis import redis
|
||||
from utils.encoders import fast_json_dumps
|
||||
@@ -135,10 +136,10 @@ async def precache_data() -> None:
|
||||
await redis.execute("SET", key, data)
|
||||
elif isinstance(data, list) and data:
|
||||
# List или ZSet
|
||||
if any(isinstance(item, (list, tuple)) and len(item) == 2 for item in data):
|
||||
if any(isinstance(item, list | tuple) and len(item) == 2 for item in data):
|
||||
# ZSet with scores
|
||||
for item in data:
|
||||
if isinstance(item, (list, tuple)) and len(item) == 2:
|
||||
if isinstance(item, list | tuple) and len(item) == 2:
|
||||
await redis.execute("ZADD", key, item[1], item[0])
|
||||
else:
|
||||
# Regular list
|
||||
|
||||
Reference in New Issue
Block a user