From f723459333c40d0b0024edd068ac2e734c6a36b2 Mon Sep 17 00:00:00 2001 From: ducklet Date: Mon, 20 May 2024 19:01:21 +0200 Subject: [PATCH] fix: open connection before using it --- unwind/web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/unwind/web.py b/unwind/web.py index 3f62a53..cfd23cc 100644 --- a/unwind/web.py +++ b/unwind/web.py @@ -237,7 +237,8 @@ async def get_ratings_for_group(request: Request) -> JSONResponse: ratings = [web_models.Rating(**r) for r in rows] - awards = await db.get_awards(conn, imdb_ids=[r.movie_imdb_id for r in ratings]) + async with db.new_connection() as conn: + awards = await db.get_awards(conn, imdb_ids=[r.movie_imdb_id for r in ratings]) aggrs = web_models.aggregate_ratings(ratings, user_ids, awards_dict=awards)