fix: VLM blocking in worker — job waits for all traces to have VLM description

Problem: vlm_done_bool=true was hardcoded, so job completed immediately
without waiting for VLM generation. After re-scan, trace_profile.json
showed vlm_summary: null.

Fix: Query trace_profiles to check VLM completion status before
marking all_ok=true. Job now blocks until vlm_done_count >= vlm_total.
This commit is contained in:
Accusys
2026-08-25 21:50:54 +08:00
parent 8b53384059
commit 8732c3e0a4
+24 -2
View File
@@ -1860,8 +1860,30 @@ impl JobWorker {
}
}
// VLM summary: non-blocking — log progress but don't block job completion
let vlm_done_bool: bool = true;
// VLM summary: blocking — wait for all traces to have VLM description
let tp_table_vlm = schema::table_name("trace_profiles");
let vlm_total: i64 = sqlx::query_scalar(&format!(
"SELECT COUNT(*) FROM {tp_table_vlm} WHERE file_uuid = $1"
))
.bind(uuid)
.fetch_one(pool)
.await
.unwrap_or(0);
let vlm_done_count: i64 = sqlx::query_scalar(&format!(
"SELECT COUNT(*) FROM {tp_table_vlm} WHERE file_uuid = $1 AND vlm_description IS NOT NULL AND vlm_description != ''"
))
.bind(uuid)
.fetch_one(pool)
.await
.unwrap_or(0);
let vlm_done_bool: bool = if vlm_total > 0 { vlm_done_count >= vlm_total } else { true };
if vlm_total > 0 {
tracing::info!(
"[Ingestion] vlm_summary={}/{} for uuid={}",
vlm_done_count, vlm_total, uuid
);
}
let all_ok = asr_done && trace_done && tkg_done && face_cluster_done && qdrant_face_done && vlm_done_bool;