fix: avoid closing shared session during embeddings (#26830)

This commit is contained in:
minglu7
2025-10-13 17:36:00 +08:00
committed by GitHub
parent c6a90d4bb3
commit 150a8276b9

View File

@@ -43,8 +43,7 @@ class CacheEmbedding(Embeddings):
else:
embedding_queue_indices.append(i)
# release database connection, because embedding may take a long time
db.session.close()
# NOTE: avoid closing the shared scoped session here; downstream code may still have pending work
if embedding_queue_indices:
embedding_queue_texts = [texts[i] for i in embedding_queue_indices]