deal db session in celery worker (#17549)
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user