From 1fbcc8f382fd3d1542e00dbb8c4e9772704a2840 Mon Sep 17 00:00:00 2001 From: Sander Niels Hummerich <64867257+hummerichsander@users.noreply.github.com> Date: Tue, 9 Jul 2024 07:07:18 +0000 Subject: [PATCH] `close_old_connections` in `process_rag_task` --- radis/rag/tasks.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radis/rag/tasks.py b/radis/rag/tasks.py index 647f4a45..576a810e 100644 --- a/radis/rag/tasks.py +++ b/radis/rag/tasks.py @@ -4,6 +4,8 @@ from itertools import batched from typing import Iterator, override +from channels.db import database_sync_to_async +from django import db from django.conf import settings from openai import OpenAI @@ -44,6 +46,7 @@ async def process_rag_task(self, task: RagTask) -> None: ) ] ) + await database_sync_to_async(db.close_old_connections)() async def process_report_instance( self, report_instance: RagReportInstance, client: AsyncChatClient, sem: Semaphore