Skip to content

Commit 0bc42b7

Browse files
committed
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.
1 parent 38a547d commit 0bc42b7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/scheduler.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,12 +578,14 @@ async fn fetch_idle(
578578
mvbox.as_deref().unwrap_or(&watch_folder)
579579
}
580580
};
581-
session
582-
.send_sync_msgs(ctx, syncbox)
583-
.await
584-
.context("fetch_idle: send_sync_msgs")
585-
.log_err(ctx)
586-
.ok();
581+
if ctx.get_config(Config::ConfiguredAddr).await?.unwrap_or_default() == connection.addr {
582+
session
583+
.send_sync_msgs(ctx, syncbox)
584+
.await
585+
.context("fetch_idle: send_sync_msgs")
586+
.log_err(ctx)
587+
.ok();
588+
}
587589

588590
session
589591
.store_seen_flags_on_imap(ctx)

0 commit comments

Comments
 (0)