feat: add intermediate status updates during processing

問題:
- Worker 只在開始時更新 status 為 scanning
- 只在完成時更新為 completed 或 failed
- 中間沒有狀態更新
- 用戶無法知道當前在哪個步驟

修復:
- ✅ Processing: 處理器開始運行時
- ✅ Indexed: Rule 1 完成時
- ✅ Completed: 全部完成時(已存在)

影響:
- 用戶可以看到處理進度
- 更好的狀態透明度
- 問題排查更容易

文檔:
- docs_v1.0/M4_workspace/2026-09-28_status_update_proposal.md

狀態: ✅ 已實施基本狀態更新
This commit is contained in:
Accusys
2026-09-29 01:21:22 +08:00
parent 3890933fe1
commit ef94fac8fa
2 changed files with 309 additions and 0 deletions
+12
View File
@@ -665,6 +665,10 @@ impl JobWorker {
crate::core::config::set_preferred_language(language);
tracing::info!("[WORKER] Set preferred language from admin config: {}", config.search.vlm_output_language);
// Update status to Processing
self.db.update_video_status(&job.uuid, VideoStatus::Processing).await?;
info!("[STATUS] Updated status to 'processing' for {}", job.uuid);
// Read face_settings from job and set environment variables for face processor
let mut face_settings_backup: Option<(String, String)> = None;
if let Some(ref fs) = job.face_settings {
@@ -2735,6 +2739,14 @@ impl JobWorker {
"✅ Rule 1 Ingestion completed: {} chunks inserted.",
count
);
// Update status to Indexed after Rule 1 completion
if let Err(e) = db_clone.update_video_status(&uuid_clone, VideoStatus::Indexed).await {
error!("[STATUS] Failed to update status to 'indexed' for {}: {}", uuid_clone, e);
} else {
info!("[STATUS] Updated status to 'indexed' for {}", uuid_clone);
}
if count > 0 {
info!(
"📝 Starting automatic vectorize for {} chunks...",