feat(indexer,backoffice): ajouter warnings dans les stats de job, skip fichiers inaccessibles

- Indexer: ajout du champ `warnings` dans JobStats pour les erreurs
  non-fatales (fichiers inaccessibles, permissions)
- Indexer: skip les fichiers dont le stat échoue au lieu de faire
  crasher tout le scan de la library
- Backoffice: affichage des warnings dans le détail job (summary,
  timeline, Index Statistics) et dans la popin jobs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 13:44:48 +01:00
parent f71ca92e85
commit fe54f55f47
5 changed files with 22 additions and 5 deletions

View File

@@ -292,6 +292,7 @@ pub async fn process_job(
indexed_files: 0,
removed_files: 0,
errors: 0,
warnings: 0,
};
let mut total_processed_count = 0i32;

View File

@@ -1,4 +1,4 @@
use anyhow::{Context, Result};
use anyhow::Result;
use chrono::{DateTime, Utc};
use parsers::{detect_format, parse_metadata_fast};
use serde::Serialize;
@@ -21,6 +21,7 @@ pub struct JobStats {
pub indexed_files: usize,
pub removed_files: usize,
pub errors: usize,
pub warnings: usize,
}
const BATCH_SIZE: usize = 100;
@@ -205,8 +206,14 @@ pub async fn scan_library_discovery(
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_else(|| abs_path.clone());
let metadata = std::fs::metadata(&path)
.with_context(|| format!("cannot stat {}", path.display()))?;
let metadata = match std::fs::metadata(&path) {
Ok(m) => m,
Err(e) => {
warn!("[SCAN] cannot stat {}, skipping: {}", path.display(), e);
stats.warnings += 1;
continue;
}
};
let mtime: DateTime<Utc> = metadata
.modified()
.map(DateTime::<Utc>::from)