revert: remove auto-create monitor_job in register
Register should only write videos table, not automatically create monitor jobs. This violates the design principle that register does not trigger deep scan. The auto-pipeline (triggered only for new files with auto_pipeline_enabled) handles job creation separately. Re-scan via processing API will handle job creation when needed.
This commit is contained in:
@@ -620,34 +620,6 @@ async fn register_single_file(
|
|||||||
let _ = std::fs::write(&probe_path, json_str);
|
let _ = std::fs::write(&probe_path, json_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure monitor_job exists with full pipeline processors.
|
|
||||||
// After unregister, the job is deleted; re-register must recreate it.
|
|
||||||
let monitor_jobs_table = schema::table_name("monitor_jobs");
|
|
||||||
let job_exists: bool = sqlx::query_scalar(&format!(
|
|
||||||
"SELECT EXISTS(SELECT 1 FROM {monitor_jobs_table} WHERE uuid = $1)"
|
|
||||||
))
|
|
||||||
.bind(&file_uuid)
|
|
||||||
.fetch_one(db.pool())
|
|
||||||
.await
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
if !job_exists && has_video && total_frames > 0 && fps > 0.0 {
|
|
||||||
let all_procs: Vec<&str> = vec!["cut", "asr", "asrx", "ocr", "face", "face_cluster"];
|
|
||||||
let _ = db
|
|
||||||
.create_monitor_job(&file_uuid, Some(&canonical_path), None)
|
|
||||||
.await;
|
|
||||||
let total = total_frames as u64;
|
|
||||||
let _ = db.init_processing_status(&file_uuid, all_procs, total).await;
|
|
||||||
let _ = sqlx::query(&format!(
|
|
||||||
"UPDATE {} SET status = 'scanning' WHERE file_uuid = $1",
|
|
||||||
videos_table
|
|
||||||
))
|
|
||||||
.bind(&file_uuid)
|
|
||||||
.execute(db.pool())
|
|
||||||
.await;
|
|
||||||
tracing::info!("[REGISTER] Created new monitor job with full pipeline for {}", file_uuid);
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterFileResponse {
|
RegisterFileResponse {
|
||||||
success: true,
|
success: true,
|
||||||
file_uuid,
|
file_uuid,
|
||||||
|
|||||||
Reference in New Issue
Block a user