Compare commits

...

2 Commits

Author SHA1 Message Date
bbcf52b006 chore: Release
All checks were successful
Continuous integration / Check (push) Successful in 38s
Continuous integration / Test Suite (push) Successful in 43s
Continuous integration / Rustfmt (push) Successful in 31s
Continuous integration / Trunk (push) Successful in 51s
Continuous integration / build (push) Successful in 51s
Continuous integration / Disallow unused dependencies (push) Successful in 2m5s
2025-04-23 11:38:48 -07:00
f92c05cd28 server: return ids processed from send_refresh_websocket_handler 2025-04-23 11:38:30 -07:00
6 changed files with 23 additions and 18 deletions

16
Cargo.lock generated
View File

@ -3034,7 +3034,7 @@ dependencies = [
[[package]]
name = "letterbox-notmuch"
version = "0.17.15"
version = "0.17.16"
dependencies = [
"itertools",
"log",
@ -3049,7 +3049,7 @@ dependencies = [
[[package]]
name = "letterbox-procmail2notmuch"
version = "0.17.15"
version = "0.17.16"
dependencies = [
"anyhow",
"clap",
@ -3062,7 +3062,7 @@ dependencies = [
[[package]]
name = "letterbox-server"
version = "0.17.15"
version = "0.17.16"
dependencies = [
"ammonia",
"anyhow",
@ -3080,8 +3080,8 @@ dependencies = [
"futures 0.3.31",
"headers",
"html-escape",
"letterbox-notmuch 0.17.15",
"letterbox-shared 0.17.15",
"letterbox-notmuch 0.17.16",
"letterbox-shared 0.17.16",
"linkify",
"log",
"lol_html",
@ -3121,10 +3121,10 @@ dependencies = [
[[package]]
name = "letterbox-shared"
version = "0.17.15"
version = "0.17.16"
dependencies = [
"build-info",
"letterbox-notmuch 0.17.15",
"letterbox-notmuch 0.17.16",
"regex",
"serde",
"sqlx",
@ -3134,7 +3134,7 @@ dependencies = [
[[package]]
name = "letterbox-web"
version = "0.17.15"
version = "0.17.16"
dependencies = [
"build-info",
"build-info-build",

View File

@ -8,7 +8,7 @@ authors = ["Bill Thiede <git@xinu.tv>"]
edition = "2021"
license = "UNLICENSED"
publish = ["xinu"]
version = "0.17.15"
version = "0.17.16"
repository = "https://git.z.xinu.tv/wathiede/letterbox"
[profile.dev]

View File

@ -27,8 +27,8 @@ css-inline = "0.14.4"
futures = "0.3.31"
headers = "0.4.0"
html-escape = "0.2.13"
letterbox-notmuch = { path = "../notmuch", version = "0.17.15", registry = "xinu" }
letterbox-shared = { path = "../shared", version = "0.17.15", registry = "xinu" }
letterbox-notmuch = { path = "../notmuch", version = "0.17.16", registry = "xinu" }
letterbox-shared = { path = "../shared", version = "0.17.16", registry = "xinu" }
linkify = "0.10.0"
log = "0.4.27"
lol_html = "2.3.0"

View File

@ -200,15 +200,21 @@ async fn send_refresh_websocket_handler(
None => Some(10),
};
if let Err(err) = label_unprocessed(&nm, &pool, false, limit, "tag:unprocessed").await {
error!("Failed to label_unprocessed: {err:?}");
let mut ids = None;
match label_unprocessed(&nm, &pool, false, limit, "tag:unprocessed").await {
Ok(i) => ids = Some(i),
Err(err) => error!("Failed to label_unprocessed: {err:?}"),
};
connection_tracker
.lock()
.await
.send_message_all(WebsocketMessage::RefreshMessages)
.await;
"refresh triggered"
if let Some(ids) = ids {
format!("{ids:?}")
} else {
"refresh triggered".to_string()
}
}
async fn watch_new(

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;

View File

@ -12,7 +12,7 @@ version.workspace = true
[dependencies]
build-info = "0.0.40"
letterbox-notmuch = { path = "../notmuch", version = "0.17.15", registry = "xinu" }
letterbox-notmuch = { path = "../notmuch", version = "0.17.16", registry = "xinu" }
regex = "1.11.1"
serde = { version = "1.0.219", features = ["derive"] }
sqlx = "0.8.5"