precache-debug
All checks were successful
Deploy on push / deploy (push) Successful in 1m8s

This commit is contained in:
Untone 2024-06-06 12:47:43 +03:00
parent 8d371e6519
commit 10ad7089f4

View File

@ -124,18 +124,20 @@ async def precache_data():
# authors # authors
authors_by_id = {} authors_by_id = {}
authors = get_with_stat(select(Author).where(Author.user.is_not(None))) authors = get_with_stat(select(Author).where(Author.user.is_not(None)))
logger.debug(f"{len(authors)} authors connected with authorizer") logger.debug(f"{len(authors)} authors found in database")
c = 0
for author in authors: for author in authors:
profile = author.dict() if not isinstance(author, dict) else author if isinstance(author, Author):
author_id = profile.get("id") profile = author.dict()
user_id = profile.get("user", "").strip() author_id = profile.get("id")
if user_id == "FyPGkAwnrXPiv2PxQ": user_id = profile.get("user", "").strip()
logger.warning(profile) if author_id and user_id:
if author_id and user_id: authors_by_id[author_id] = profile
authors_by_id[author_id] = profile await cache_author(profile)
await cache_author(profile) c += 1
else: else:
logger.error(f"fail caching {author.dict()}") logger.error(f"fail caching {author}")
logger.info(f"{len(authors)} authors precached") logger.info(f"{len(authors)} authors precached")
# followings for authors # followings for authors