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