This commit is contained in:
parent
fa7b05a86e
commit
04d918749f
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from sqlalchemy import select, or_, and_, text, desc, cast, Integer
|
from sqlalchemy import select, or_, and_, text, desc
|
||||||
from sqlalchemy.orm import aliased
|
from sqlalchemy.orm import aliased
|
||||||
from sqlalchemy_searchable import search
|
from sqlalchemy_searchable import search
|
||||||
|
|
||||||
|
@ -219,11 +219,7 @@ async def get_author_followers(_, _info, slug: str):
|
||||||
try:
|
try:
|
||||||
with local_session() as session:
|
with local_session() as session:
|
||||||
author_alias = aliased(Author)
|
author_alias = aliased(Author)
|
||||||
author_id_result = (
|
author_id = session.query(author_alias).filter(author_alias.slug == slug).first()
|
||||||
session.query(author_alias).filter(author_alias.slug == slug).first()
|
|
||||||
)
|
|
||||||
author = author_id_result[0] if author_id_result else None
|
|
||||||
author_id = cast(author.id, Integer)
|
|
||||||
cached = await redis.execute('GET', f'id:{author_id}:followers')
|
cached = await redis.execute('GET', f'id:{author_id}:followers')
|
||||||
results = []
|
results = []
|
||||||
if not cached:
|
if not cached:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user