fix: Face Trace 完成時同步 videos.processing_status JSON
Core Test / lint-and-test (push) Has been cancelled
Cross-Project Integration / integration (push) Has been cancelled

根因: FaceTrace 走獨立 pipeline(非 processor pool),當 face_traced.json
已存在而 skip spawn、或實際執行完成時,只更新 processor_results 表,
沒有更新 videos.processing_status 的 FACE_TRACE progress。

結果: 前端讀 processing_status 顯示 FACE_TRACE=running/0,
但 FACE_CLUSTER(走 processor pool)已 completed → 看起來違反依賴規則。

修復: 兩個完成路徑都補上 update_processor_progress('face_trace', completed):
- skip 路徑(already done)
- 實際執行成功路徑
手動修正 090.mp4 的 processing_status(先前 jsonb_set 路徑錯誤清空,
已重建完整 progress)。
This commit is contained in:
Accusys
2026-11-19 21:44:02 +08:00
parent 36fc4d0360
commit 532a2287c5
+42 -1
View File
@@ -4124,7 +4124,27 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
if trace_complete {
info!("✅ Face trace already done for {}, skipping spawn", uuid);
// Keep videos.processing_status JSON in sync: mark FACE_TRACE
// completed with full frame count. Without this, the UI shows
// FACE_TRACE stuck at running/0 while FACE_CLUSTER is completed
// (which looks like a broken dependency).
let tf = self
.db
.get_video_by_uuid(uuid)
.await
.ok()
.flatten()
.map(|v| v.total_frames as u64)
.unwrap_or(0);
if let Err(e) = self
.db
.update_processor_progress(uuid, "face_trace", tf, tf, "completed")
.await
{
warn!("[FACE_TRACE] failed to mark progress completed for {}: {}", uuid, e);
}
// ✅ Ensure processor_results record exists for dependency checks
let mut success = false;
for attempt in 1..=3 {
@@ -4420,6 +4440,27 @@ async fn process_job(&self, job: crate::core::db::MonitorJob) -> Result<()> {
&pp,
)
.await;
// Sync videos.processing_status JSON (UI source of truth)
let tf = db_clone
.get_video_by_uuid(&uuid_clone)
.await
.ok()
.flatten()
.map(|v| v.total_frames as u64)
.unwrap_or(0);
if let Err(e) = db_clone
.update_processor_progress(
&uuid_clone,
"face_trace",
tf,
tf,
"completed",
)
.await
{
warn!("[FACE_TRACE] failed to mark progress completed for {}: {}", uuid_clone, e);
}
}
Err(e) => {
error!(