deal db session in celery worker (#17549)
This commit is contained in:
parent
da7f8ad936
commit
c8145ce581
26 changed files with 104 additions and 25 deletions
|
|
@ -6,6 +6,7 @@ from celery import shared_task # type: ignore
|
|||
|
||||
from core.rag.datasource.vdb.vector_factory import Vector
|
||||
from core.rag.models.document import Document
|
||||
from extensions.ext_database import db
|
||||
from models.dataset import Dataset
|
||||
from services.dataset_service import DatasetCollectionBindingService
|
||||
|
||||
|
|
@ -55,3 +56,5 @@ def add_annotation_to_index_task(
|
|||
)
|
||||
except Exception:
|
||||
logging.exception("Build index for annotation failed")
|
||||
finally:
|
||||
db.session.close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue