session-close-fix

This commit is contained in:
2024-05-26 02:17:45 +03:00
parent 3742528e3a
commit da89b20e5c
3 changed files with 136 additions and 125 deletions

View File

@@ -73,8 +73,8 @@ async def follow(_, info, what, slug):
_topic_dict = await cache_by_slug(what, slug)
elif what == "COMMUNITY":
# FIXME: when more communities
follows = local_session().execute(select(Community))
with local_session() as session:
follows = session.execute(select(Community))
elif what == "SHOUT":
error = reactions_follow(follower_id, slug)
@@ -122,7 +122,8 @@ async def unfollow(_, info, what, slug):
_topic_dict = await cache_by_slug(what, slug)
elif what == "COMMUNITY":
follows = local_session().execute(select(Community))
with local_session() as session:
follows = session.execute(select(Community))
elif what == "SHOUT":
error = reactions_unfollow(follower_id, slug)