fix: job never completes - processor_results.file_uuid is NULL

- ingestion_complete query used file_uuid column which is always NULL
- Changed to JOIN processor_results with monitor_jobs on job_id
- All stuck jobs now complete successfully
This commit is contained in:
Accusys
2026-07-02 16:42:24 +08:00
parent bd6d108ade
commit e2b3858b67

View File

@@ -1096,9 +1096,10 @@ impl JobWorker {
let has_face = job_processors.is_empty() || job_processors.iter().any(|p| p == "face");
// Check asr_status for ASR/ASRX - if no_audio_track or silent_audio, ingestion is complete
let mj_t = schema::table_name("monitor_jobs");
let asr_done: bool = if has_asr_or_asrx {
let asr_status: Option<String> = sqlx::query_scalar(&format!(
"SELECT asr_status FROM {pr_t} WHERE file_uuid = $1 AND processor IN ('asr', 'asrx') LIMIT 1"
"SELECT asr_status FROM {pr_t} pr JOIN {mj_t} mj ON pr.job_id = mj.id WHERE mj.uuid = $1 AND pr.processor IN ('asr', 'asrx') LIMIT 1"
))
.bind(uuid)
.fetch_optional(pool)