feat: add Waiting status for long-running operations

問題:
- 處理過程中有長時間等待
- 用戶不知道為什麼卡住
- 無法區分「處理中」和「等待中」

修復:
- ✅ 添加 VideoStatus::Waiting 狀態
- ✅ 修復重複的 match arms
- ✅ TKG verification 前設為 Waiting
- ✅ Ingestion 前設為 Waiting

狀態流程:
- Scanning → Processing → Waiting → Indexed → Completed

用戶體驗:
- 等待 TKG 時顯示 'waiting'
- 等待 ingestion 時顯示 'waiting'
- 更清晰的狀態區分

狀態: ✅ 已實施
This commit is contained in:
Accusys
2026-09-29 01:35:19 +08:00
parent 23321376d8
commit aa4e50f4dc
2 changed files with 15 additions and 10 deletions
+12
View File
@@ -3402,6 +3402,12 @@ impl JobWorker {
let filter = serde_json::json!({
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
});
// Update status to Waiting during TKG verification
if let Err(e) = self.db.update_video_status(uuid, VideoStatus::Waiting).await {
error!("[STATUS] Failed to update status to 'waiting' for TKG: {}", e);
}
let mut attempts = 0;
let max_attempts = 60;
let mut stable_trace_count: Option<i64> = None;
@@ -3721,6 +3727,12 @@ impl JobWorker {
"Job {}: all processors done, waiting for ingestion...",
job_id
);
// Update status to Waiting during ingestion phase
if let Err(e) = self.db.update_video_status(uuid, VideoStatus::Waiting).await {
error!("[STATUS] Failed to update status to 'waiting' for {}: {}", uuid, e);
}
return Ok(false);
}