diff --git a/resolvers/reaction.py b/resolvers/reaction.py index 36de92f9..6ca29db8 100644 --- a/resolvers/reaction.py +++ b/resolvers/reaction.py @@ -577,7 +577,9 @@ async def load_shout_comments(_, info, shout: int, limit=50, offset=0): func.count(aliased_reaction.id).label("reacted_stat"), func.count(aliased_reaction.body).label("commented_stat"), func.sum(case((aliased_reaction.kind == str(ReactionKind.LIKE.value), 1), else_=0)).label("likes_stat"), - func.sum(case((aliased_reaction.kind == str(ReactionKind.DISLIKE.value), 1), else_=0)).label("dislikes_stat"), + func.sum(case((aliased_reaction.kind == str(ReactionKind.DISLIKE.value), 1), else_=0)).label( + "dislikes_stat" + ), ) .select_from(Reaction) .join(Author, Reaction.created_by == Author.id) @@ -606,9 +608,9 @@ async def load_shout_comments(_, info, shout: int, limit=50, offset=0): return list(reactions) + @query.field("load_comment_ratings") async def load_comment_ratings(_, info, comment: int, limit=50, offset=0): - """ getting paginated comments with stats :param info: graphql meta @@ -626,7 +628,9 @@ async def load_comment_ratings(_, info, comment: int, limit=50, offset=0): func.count(aliased_reaction.id).label("reacted_stat"), func.count(aliased_reaction.body).label("commented_stat"), func.sum(case((aliased_reaction.kind == str(ReactionKind.LIKE.value), 1), else_=0)).label("likes_stat"), - func.sum(case((aliased_reaction.kind == str(ReactionKind.DISLIKE.value), 1), else_=0)).label("dislikes_stat"), + func.sum(case((aliased_reaction.kind == str(ReactionKind.DISLIKE.value), 1), else_=0)).label( + "dislikes_stat" + ), ) .select_from(Reaction) .join(Author, Reaction.created_by == Author.id) diff --git a/services/db.py b/services/db.py index 58c4588d..5802518d 100644 --- a/services/db.py +++ b/services/db.py @@ -17,7 +17,8 @@ from settings import DB_URL # Подключение к базе данных SQLAlchemy -engine = create_engine(DB_URL, +engine = create_engine( + DB_URL, echo=False, pool_size=10, max_overflow=20, diff --git a/services/sentry.py b/services/sentry.py index b9880c44..18d21ab6 100644 --- a/services/sentry.py +++ b/services/sentry.py @@ -18,11 +18,7 @@ def start_sentry(): # We recommend adjusting this value in production. profiles_sample_rate=1.0, enable_tracing=True, - integrations=[ - StarletteIntegration(), - AriadneIntegration(), - SqlalchemyIntegration() - ], + integrations=[StarletteIntegration(), AriadneIntegration(), SqlalchemyIntegration()], ) except Exception as e: print("[services.sentry] init error")