mirror of
https://github.com/rustmailer/rustmailer.git
synced 2026-08-26 08:00:43 +00:00
fix: skip mailbox sync when uid_validity is None
This commit is contained in:
Vendored
+7
@@ -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.",
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user