server: return ids processed from send_refresh_websocket_handler

This commit is contained in:
2025-04-23 11:38:30 -07:00
parent 885bbe0a8c
commit f92c05cd28
2 changed files with 11 additions and 6 deletions

View File

@@ -946,7 +946,7 @@ pub async fn label_unprocessed(
dryrun: bool,
limit: Option<usize>,
query: &str,
) -> Result<(), ServerError> {
) -> Result<Box<[String]>, ServerError> {
use futures::StreamExt;
let ids = nm.message_ids(query)?;
info!(
@@ -990,7 +990,6 @@ pub async fn label_unprocessed(
// Only process the first file path is multiple files have the same id
let path = files.iter().next().unwrap();
let file = File::open(&path)?;
info!("mmaping {path}");
let mmap = unsafe { MmapOptions::new().map(&file)? };
let m = parse_mail(&mmap)?;
let (matched_rule, add_tags) = find_tags(&rules, &m.headers);
@@ -1067,7 +1066,7 @@ pub async fn label_unprocessed(
}
}
Ok(())
Ok(ids.into())
}
fn find_tags<'a, 'b>(rules: &'a [Rule], headers: &'b [MailHeader]) -> (bool, HashSet<&'a str>) {
let mut matched_rule = false;