From 4d06f5a8aecbec1d3c792c317e98194c667a2141 Mon Sep 17 00:00:00 2001 From: link2xt Date: Wed, 26 Nov 2025 18:00:17 +0000 Subject: [PATCH] fix: upload sync messages only with the primary transport Currently there is a race between transports to upload sync messages and delete them from `imap_send` table. Sometimes mulitple transports upload the same message and sometimes only some of them "win". With this change only the primary transport will upload the sync message. --- src/imap.rs | 2 +- src/scheduler.rs | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/imap.rs b/src/imap.rs index e9ccc95f2..006314225 100644 --- a/src/imap.rs +++ b/src/imap.rs @@ -79,7 +79,7 @@ pub(crate) struct Imap { pub(crate) idle_interrupt_receiver: Receiver<()>, /// Email address. - addr: String, + pub(crate) addr: String, /// Login parameters. lp: Vec, diff --git a/src/scheduler.rs b/src/scheduler.rs index ab809c987..54be6f7bc 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -578,12 +578,19 @@ async fn fetch_idle( mvbox.as_deref().unwrap_or(&watch_folder) } }; - session - .send_sync_msgs(ctx, syncbox) - .await - .context("fetch_idle: send_sync_msgs") - .log_err(ctx) - .ok(); + if ctx + .get_config(Config::ConfiguredAddr) + .await? + .unwrap_or_default() + == connection.addr + { + session + .send_sync_msgs(ctx, syncbox) + .await + .context("fetch_idle: send_sync_msgs") + .log_err(ctx) + .ok(); + } session .store_seen_flags_on_imap(ctx)