From cce30ffacb84c925bc1419ca4315b82afc7da259 Mon Sep 17 00:00:00 2001 From: Accusys Date: Sun, 23 Aug 2026 02:44:48 +0800 Subject: [PATCH] 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. --- src/api/files.rs | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/api/files.rs b/src/api/files.rs index 9ba603b8..1127dca6 100644 --- a/src/api/files.rs +++ b/src/api/files.rs @@ -620,34 +620,6 @@ async fn register_single_file( 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 { success: true, file_uuid,