cache-fix
All checks were successful
Deploy on push / deploy (push) Successful in 47s

This commit is contained in:
Untone 2024-05-30 17:49:33 +03:00
parent 98010ed1bc
commit d20647c825

View File

@ -115,9 +115,9 @@ async def get_cached_author_follows_authors(author_id: int):
select(Author.id) select(Author.id)
.select_from(join(Author, AuthorFollower, Author.id == AuthorFollower.author)) .select_from(join(Author, AuthorFollower, Author.id == AuthorFollower.author))
.where(AuthorFollower.follower == author_id) .where(AuthorFollower.follower == author_id)
.all()
) )
authors = local_session().execute(authors_query) with local_session() as session:
authors = session.execute(authors_query)
await redis.execute("SET", rkey, json.dumps([aid for aid in authors])) await redis.execute("SET", rkey, json.dumps([aid for aid in authors]))
elif isinstance(cached, str): elif isinstance(cached, str):
authors = json.loads(cached) authors = json.loads(cached)