fix: processor status timestamps and admin config defaults
** Problem 1: started_at not set - update_processor_result() ignored started_at/completed_at parameters - Only updated 'status' field, leaving timestamps as None - Caused false 'running' state detection ** Problem 2: AdminConfig missing fields - admin_config.json missing required fields (updated_at, paths, etc.) - JSON parsing failed, caused panic on worker startup - Lazy instance poisoned, all processors failed ** Fix: 1. update_processor_result now sets timestamps automatically: - Running -> started_at = CURRENT_TIMESTAMP - Completed/Failed -> completed_at = CURRENT_TIMESTAMP 2. Added #[serde(default)] to all AdminConfig fields - Allows partial config files - Missing fields get default values ** Impact: - Processor status now accurately tracked - Worker can start with minimal config - UI 'Deep Scan' deadlock resolved
This commit is contained in:
@@ -3390,7 +3390,20 @@ impl PostgresDb {
|
||||
) -> Result<()> {
|
||||
let table = schema::table_name("processor_results");
|
||||
let s = format!("{:?}", status).to_lowercase();
|
||||
sqlx::query(&format!("UPDATE {} SET status = $1 WHERE id = $2", table))
|
||||
|
||||
let query = match status {
|
||||
crate::core::db::ProcessorJobStatus::Running => {
|
||||
format!("UPDATE {} SET status = $1, started_at = CURRENT_TIMESTAMP WHERE id = $2", table)
|
||||
}
|
||||
crate::core::db::ProcessorJobStatus::Completed | crate::core::db::ProcessorJobStatus::Failed => {
|
||||
format!("UPDATE {} SET status = $1, completed_at = CURRENT_TIMESTAMP WHERE id = $2", table)
|
||||
}
|
||||
_ => {
|
||||
format!("UPDATE {} SET status = $1 WHERE id = $2", table)
|
||||
}
|
||||
};
|
||||
|
||||
sqlx::query(&query)
|
||||
.bind(&s)
|
||||
.bind(result_id)
|
||||
.execute(&self.pool)
|
||||
|
||||
Reference in New Issue
Block a user