refactor: simplify status to scanning and completed only
變更: - ✅ 移除 Processing 狀態 - ✅ 移除 Waiting 狀態 - ✅ 移除 Indexed 狀態 - ✅ 移除其他中間狀態 - ✅ 只保留 Scanning 和 Completed VideoStatus 枚舉: - Unregistered - Registered - Pending - Queued - Scanning (處理中) - Completed (完成) - Failed (失敗) 狀態流程: Scanning → Completed 簡化原因: - 中間狀態太多導致用戶困惑 - Scanning 和 Completed 足夠表示處理狀態 - 其他狀態(Pending, Queued, Failed)仍保留 狀態: ✅ 已實施
This commit is contained in:
@@ -232,16 +232,6 @@ pub enum VideoStatus {
|
|||||||
Pending,
|
Pending,
|
||||||
Queued,
|
Queued,
|
||||||
Scanning,
|
Scanning,
|
||||||
Processing,
|
|
||||||
Waiting,
|
|
||||||
Processed,
|
|
||||||
Indexed,
|
|
||||||
CheckedOut,
|
|
||||||
KeywordReady,
|
|
||||||
SemanticReady,
|
|
||||||
PeopleReady,
|
|
||||||
FaceMgmtReady,
|
|
||||||
AgentReady,
|
|
||||||
Completed,
|
Completed,
|
||||||
Failed,
|
Failed,
|
||||||
}
|
}
|
||||||
@@ -254,16 +244,6 @@ impl VideoStatus {
|
|||||||
VideoStatus::Pending => "pending",
|
VideoStatus::Pending => "pending",
|
||||||
VideoStatus::Queued => "queued",
|
VideoStatus::Queued => "queued",
|
||||||
VideoStatus::Scanning => "scanning",
|
VideoStatus::Scanning => "scanning",
|
||||||
VideoStatus::Processing => "processing",
|
|
||||||
VideoStatus::Waiting => "waiting",
|
|
||||||
VideoStatus::Processed => "processed",
|
|
||||||
VideoStatus::Indexed => "indexed",
|
|
||||||
VideoStatus::CheckedOut => "checked_out",
|
|
||||||
VideoStatus::KeywordReady => "keyword_ready",
|
|
||||||
VideoStatus::SemanticReady => "semantic_ready",
|
|
||||||
VideoStatus::PeopleReady => "people_ready",
|
|
||||||
VideoStatus::FaceMgmtReady => "face_mgmt_ready",
|
|
||||||
VideoStatus::AgentReady => "agent_ready",
|
|
||||||
VideoStatus::Completed => "completed",
|
VideoStatus::Completed => "completed",
|
||||||
VideoStatus::Failed => "failed",
|
VideoStatus::Failed => "failed",
|
||||||
}
|
}
|
||||||
@@ -276,16 +256,6 @@ impl VideoStatus {
|
|||||||
"pending" => Some(VideoStatus::Pending),
|
"pending" => Some(VideoStatus::Pending),
|
||||||
"queued" => Some(VideoStatus::Queued),
|
"queued" => Some(VideoStatus::Queued),
|
||||||
"scanning" => Some(VideoStatus::Scanning),
|
"scanning" => Some(VideoStatus::Scanning),
|
||||||
"processing" => Some(VideoStatus::Processing),
|
|
||||||
"waiting" => Some(VideoStatus::Waiting),
|
|
||||||
"processed" => Some(VideoStatus::Processed),
|
|
||||||
"indexed" => Some(VideoStatus::Indexed),
|
|
||||||
"checked_out" => Some(VideoStatus::CheckedOut),
|
|
||||||
"keyword_ready" => Some(VideoStatus::KeywordReady),
|
|
||||||
"semantic_ready" => Some(VideoStatus::SemanticReady),
|
|
||||||
"people_ready" => Some(VideoStatus::FaceMgmtReady),
|
|
||||||
"face_mgmt_ready" => Some(VideoStatus::FaceMgmtReady),
|
|
||||||
"agent_ready" => Some(VideoStatus::AgentReady),
|
|
||||||
"completed" => Some(VideoStatus::Completed),
|
"completed" => Some(VideoStatus::Completed),
|
||||||
"failed" => Some(VideoStatus::Failed),
|
"failed" => Some(VideoStatus::Failed),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|||||||
@@ -665,10 +665,6 @@ impl JobWorker {
|
|||||||
crate::core::config::set_preferred_language(language);
|
crate::core::config::set_preferred_language(language);
|
||||||
tracing::info!("[WORKER] Set preferred language from admin config: {}", config.search.vlm_output_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
|
// Read face_settings from job and set environment variables for face processor
|
||||||
let mut face_settings_backup: Option<(String, String)> = None;
|
let mut face_settings_backup: Option<(String, String)> = None;
|
||||||
if let Some(ref fs) = job.face_settings {
|
if let Some(ref fs) = job.face_settings {
|
||||||
@@ -2740,13 +2736,6 @@ impl JobWorker {
|
|||||||
count
|
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 {
|
if count > 0 {
|
||||||
info!(
|
info!(
|
||||||
"📝 Starting automatic vectorize for {} chunks...",
|
"📝 Starting automatic vectorize for {} chunks...",
|
||||||
@@ -3403,11 +3392,6 @@ impl JobWorker {
|
|||||||
"must": [{"key": "file_uuid", "match": {"value": uuid}}]
|
"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 mut attempts = 0;
|
||||||
let max_attempts = 60;
|
let max_attempts = 60;
|
||||||
let mut stable_trace_count: Option<i64> = None;
|
let mut stable_trace_count: Option<i64> = None;
|
||||||
@@ -3728,11 +3712,6 @@ impl JobWorker {
|
|||||||
job_id
|
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);
|
return Ok(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user