From e942fdbffa4b99272e4ec95a545d1a82c5567086 Mon Sep 17 00:00:00 2001 From: Untone Date: Wed, 5 Jun 2024 22:27:23 +0300 Subject: [PATCH] debug-precache --- services/precache.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/precache.py b/services/precache.py index 7fb5b91e..eef916a7 100644 --- a/services/precache.py +++ b/services/precache.py @@ -111,12 +111,14 @@ async def precache_data(): for author in authors: profile = author.dict() if not isinstance(author, dict) else author author_id = profile.get("id") - if author_id: + user_id = profile.get("user") + if author_id and user_id: authors_by_id[author_id] = profile - user_id = profile["user"] author_payload = json.dumps(profile, cls=CustomJSONEncoder) await redis.execute("SET", f"author:id:{author_id}", author_payload) await redis.execute("SET", f"author:user:{user_id.strip()}", author_payload) + else: + logger.error(f"caching {author.dict()}") logger.info(f"{len(authors)} authors precached") # followings for authors