Skip to content

Commit c33d56f

Browse files
committed
fix: 移除 collection.flush() Fixes #297
1 parent 7c40d6c commit c33d56f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/knowledge/implementations/milvus.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,10 @@ async def add_content(self, db_id: str, items: list[str], params: dict | None =
263263
embeddings,
264264
]
265265

266-
def _insert_and_flush():
266+
def _insert_records():
267267
collection.insert(entities)
268-
collection.flush()
269268

270-
await asyncio.to_thread(_insert_and_flush)
269+
await asyncio.to_thread(_insert_records)
271270

272271
logger.info(f"Inserted {content_type} {item} into Milvus. Done.")
273272

@@ -363,7 +362,6 @@ async def delete_file(self, db_id: str, file_id: str) -> None:
363362
def _delete_from_milvus():
364363
try:
365364
collection.delete(expr)
366-
collection.flush()
367365
logger.info(f"Deleted chunks for file {file_id} from Milvus")
368366
except Exception as e:
369367
logger.error(f"Error deleting file {file_id} from Milvus: {e}")

0 commit comments

Comments
 (0)