server: more debug prints

This commit is contained in:
Bill Thiede 2025-04-23 09:31:25 -07:00
parent 4c486e9168
commit 0f6af0f475

View File

@ -990,6 +990,7 @@ pub async fn label_unprocessed(
// Only process the first file path is multiple files have the same id // Only process the first file path is multiple files have the same id
let path = files.iter().next().unwrap(); let path = files.iter().next().unwrap();
let file = File::open(&path)?; let file = File::open(&path)?;
info!("mmaping {path}");
let mmap = unsafe { MmapOptions::new().map(&file)? }; let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = parse_mail(&mmap)?; let m = parse_mail(&mmap)?;
let (matched_rule, add_tags) = find_tags(&rules, &m.headers); let (matched_rule, add_tags) = find_tags(&rules, &m.headers);
@ -1049,17 +1050,17 @@ pub async fn label_unprocessed(
.push(id.clone()); .push(id.clone());
} }
} }
println!("Adding {} distinct labels", add_mutations.len()); info!("Adding {} distinct labels", add_mutations.len());
for (tag, ids) in add_mutations.iter() { for (tag, ids) in add_mutations.iter() {
println!(" {tag}: {}", ids.len()); info!(" {tag}: {}", ids.len());
if !dryrun { if !dryrun {
let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect(); let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect();
nm.tags_add(tag, &ids)?; nm.tags_add(tag, &ids)?;
} }
} }
println!("Removing {} distinct labels", rm_mutations.len()); info!("Removing {} distinct labels", rm_mutations.len());
for (tag, ids) in rm_mutations.iter() { for (tag, ids) in rm_mutations.iter() {
println!(" {tag}: {}", ids.len()); info!(" {tag}: {}", ids.len());
if !dryrun { if !dryrun {
let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect(); let ids: Vec<_> = ids.iter().map(|s| s.as_str()).collect();
nm.tags_remove(tag, &ids)?; nm.tags_remove(tag, &ids)?;