mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Fix database connections leakage (#980)
This commit is contained in:
parent
69ef6829c1
commit
00b1af8f99
1 changed files with 2 additions and 0 deletions
|
@ -27,6 +27,7 @@ from django.contrib.sessions.backends.db import SessionStore
|
||||||
from django.db.models import Prefetch, Q
|
from django.db.models import Prefetch, Q
|
||||||
from django.db.models.manager import BaseManager
|
from django.db.models.manager import BaseManager
|
||||||
from django.db.utils import IntegrityError
|
from django.db.utils import IntegrityError
|
||||||
|
from django_apscheduler import util
|
||||||
from django_apscheduler.models import DjangoJob, DjangoJobExecution
|
from django_apscheduler.models import DjangoJob, DjangoJobExecution
|
||||||
from fastapi import HTTPException
|
from fastapi import HTTPException
|
||||||
from pgvector.django import CosineDistance
|
from pgvector.django import CosineDistance
|
||||||
|
@ -606,6 +607,7 @@ class ProcessLockAdapters:
|
||||||
logger.debug(f"Skip removing {operation} process lock as it was not set")
|
logger.debug(f"Skip removing {operation} process lock as it was not set")
|
||||||
|
|
||||||
|
|
||||||
|
@util.close_old_connections
|
||||||
def run_with_process_lock(*args, **kwargs):
|
def run_with_process_lock(*args, **kwargs):
|
||||||
"""Wrapper function used for scheduling jobs.
|
"""Wrapper function used for scheduling jobs.
|
||||||
Required as APScheduler can't discover the `ProcessLockAdapter.run_with_lock' method on its own.
|
Required as APScheduler can't discover the `ProcessLockAdapter.run_with_lock' method on its own.
|
||||||
|
|
Loading…
Reference in a new issue