perf: 优化向量库连接性能

This commit is contained in:
2026-05-28 11:16:09 +08:00
parent 8b600f9d6c
commit f324acb83c

View File

@@ -47,7 +47,7 @@ import java.util.*;
/** /**
* Milvus vector store based on Milvus Java SDK v2. * Milvus vector store based on Milvus Java SDK v2.
*/ */
public class MilvusVectorStore extends DocumentStore { public class MilvusVectorStore extends DocumentStore implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(MilvusVectorStore.class); private static final Logger LOG = LoggerFactory.getLogger(MilvusVectorStore.class);
private static final long LOAD_TIMEOUT_MS = 30_000L; private static final long LOAD_TIMEOUT_MS = 30_000L;
@@ -546,4 +546,14 @@ public class MilvusVectorStore extends DocumentStore {
return false; return false;
} }
} }
@Override
public void close() {
try {
client.close(1L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
LOG.warn("Interrupted while closing Milvus client. uri={}", config.getUri(), e);
}
}
} }