diff --git a/Cargo.lock b/Cargo.lock index d16910c..177ce61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1103,9 +1103,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.45" +version = "4.5.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc0e74a703892159f5ae7d3aac52c8e6c392f5ae5f359c70b5881d60aaac318" +checksum = "2c5e4fcf9c21d2e544ca1ee9d8552de13019a42aa7dbf32747fa7aaf1df76e57" dependencies = [ "clap_builder", "clap_derive", @@ -1113,9 +1113,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.44" +version = "4.5.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e7f4214277f3c7aa526a59dd3fbe306a370daee1f8b7b8c987069cd8e888a8" +checksum = "fecb53a0e6fcfb055f686001bc2e2592fa527efaf38dbe81a6a9563562e57d41" dependencies = [ "anstream", "anstyle", @@ -3383,9 +3383,9 @@ dependencies = [ [[package]] name = "libmimalloc-sys" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88cd67e9de251c1781dbe2f641a1a3ad66eaae831b8a2c38fbdc5ddae16d4d" +checksum = "667f4fec20f29dfc6bc7357c582d91796c169ad7e2fce709468aefeb2c099870" dependencies = [ "cc", "libc", @@ -3705,9 +3705,9 @@ dependencies = [ [[package]] name = "mimalloc" -version = "0.1.47" +version = "0.1.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1791cbe101e95af5764f06f20f6760521f7158f69dbf9d6baf941ee1bf6bc40" +checksum = "e1ee66a4b64c74f4ef288bcbb9192ad9c3feaad75193129ac8509af543894fd8" dependencies = [ "libmimalloc-sys", ] @@ -5725,7 +5725,7 @@ dependencies = [ [[package]] name = "rustmailer" -version = "1.4.1" +version = "1.5.0" dependencies = [ "ahash", "async-imap", diff --git a/Cargo.toml b/Cargo.toml index 83d9f7c..58c4718 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rustmailer" -version = "1.4.1" +version = "1.5.0" edition = "2021" [[bin]] @@ -20,8 +20,8 @@ codegen-units = 1 [dependencies] chrono = "0.4.41" -clap = { version = "4.5.45", features = ["derive", "env"] } -mimalloc = "0.1.47" +clap = { version = "4.5.46", features = ["derive", "env"] } +mimalloc = "0.1.48" native_db = "0.8.2" redb = "2.6.2" itertools = "0.14.0" diff --git a/src/modules/cache/imap/sync/flow.rs b/src/modules/cache/imap/sync/flow.rs index 6c1b974..2f34daf 100644 --- a/src/modules/cache/imap/sync/flow.rs +++ b/src/modules/cache/imap/sync/flow.rs @@ -310,6 +310,13 @@ pub async fn compare_and_sync_mailbox( let mut mailboxes_to_update = Vec::with_capacity(existing_mailboxes.len()); for (local_mailbox, remote_mailbox) in &existing_mailboxes { if local_mailbox.uid_validity != remote_mailbox.uid_validity { + if remote_mailbox.uid_validity.is_none() { + warn!( + "Account {}: Mailbox '{}' has invalid uid_validity (None). Skipping sync for this mailbox.", + account_id, local_mailbox.name + ); + continue; + } info!( "Account {}: Mailbox '{}' detected with changed uid_validity (local: {:#?}, remote: {:#?}). \ The mailbox data may be invalid, resetting its envelopes and rebuilding the cache.", diff --git a/src/modules/cache/imap/sync/mod.rs b/src/modules/cache/imap/sync/mod.rs index d02ba74..1d29987 100644 --- a/src/modules/cache/imap/sync/mod.rs +++ b/src/modules/cache/imap/sync/mod.rs @@ -29,7 +29,7 @@ pub mod sync_type; static SYNC_COUNTER: AtomicUsize = AtomicUsize::new(0); -pub async fn execute_account_sync(account: &AccountV2) -> RustMailerResult<()> { +pub async fn execute_imap_sync(account: &AccountV2) -> RustMailerResult<()> { let start_time = Instant::now(); let account_id = account.id; diff --git a/src/modules/cache/imap/task.rs b/src/modules/cache/imap/task.rs index 43e5b83..53f57f6 100644 --- a/src/modules/cache/imap/task.rs +++ b/src/modules/cache/imap/task.rs @@ -3,7 +3,7 @@ // Unauthorized copying, modification, or distribution is prohibited. use crate::modules::account::entity::{AuthType, MailerType}; -use crate::modules::cache::imap::sync::execute_account_sync; +use crate::modules::cache::imap::sync::execute_imap_sync; use crate::modules::oauth2::token::OAuth2AccessToken; use crate::modules::scheduler::periodic::TaskHandle; use crate::modules::{ @@ -71,7 +71,7 @@ impl AccountSyncTask { return Ok(()); } } - if let Err(e) = execute_account_sync(&account).await { + if let Err(e) = execute_imap_sync(&account).await { STATUS_DISPATCHER .append_error( account_id,