fix: wait for Qdrant face points before TKG build

- Add Qdrant count verification before TKG build
- Wait up to 30 seconds for Qdrant to have all face embeddings
- Prevents race condition where TKG reads incomplete data
- Add count_points method to QdrantDb
This commit is contained in:
Accusys
2026-07-20 23:26:42 +08:00
parent bc914ce3df
commit 29d2cc7315
2 changed files with 72 additions and 4 deletions
+35
View File
@@ -884,6 +884,41 @@ impl QdrantDb {
Ok(all_points)
}
pub async fn count_points(
&self,
collection: &str,
filter: serde_json::Value,
) -> Result<i64> {
let url = format!(
"{}/collections/{}/points/count",
self.base_url, collection
);
let body = serde_json::json!({
"filter": filter,
"exact": true
});
let resp = self
.client
.post(&url)
.header("api-key", &self.api_key)
.header("Content-Type", "application/json")
.json(&body)
.send()
.await?;
if !resp.status().is_success() {
anyhow::bail!("Qdrant count failed: {}", resp.status());
}
let result: serde_json::Value = resp.json().await?;
let count = result["result"]["count"]
.as_i64()
.unwrap_or(0);
Ok(count)
}
/// Update payload for points matching a filter
pub async fn update_payload_by_filter(
&self,