From c12ff2e7c70655ff6c80c8030a6b4d2fd3c45ab7 Mon Sep 17 00:00:00 2001 From: Squeaky Date: Fri, 8 Nov 2024 10:07:45 +0100 Subject: [PATCH] new_uids --- inbox/mailsync/backends/imap/generic.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inbox/mailsync/backends/imap/generic.py b/inbox/mailsync/backends/imap/generic.py index 9d78a3d8b..2ad2234bc 100644 --- a/inbox/mailsync/backends/imap/generic.py +++ b/inbox/mailsync/backends/imap/generic.py @@ -877,11 +877,15 @@ def condstore_refresh_flags(self, crispin_client: CrispinClient) -> None: self.account_id, db_session, self.folder_id ) + new_uids = remote_uids.difference(local_uids) expunged_uids = local_uids.difference(remote_uids) del local_uids # free memory as soon as possible max_remote_uid = max(remote_uids) if remote_uids else 0 del remote_uids # free memory as soon as possible + if new_uids: + self.download_and_commit_uids(crispin_client, new_uids) + if expunged_uids: # If new UIDs have appeared since we last checked in # get_new_uids, save them first. We want to always have the @@ -929,10 +933,14 @@ def refresh_flags_impl(self, crispin_client: CrispinClient, max_uids: int) -> No self.account_id, db_session, self.folder_id ) + new_uids = remote_uids.difference(local_uids) expunged_uids = local_uids.difference(remote_uids) del local_uids # free memory as soon as possible del remote_uids # free memory as soon as possible + if new_uids: + self.download_and_commit_uids(crispin_client, new_uids) + if expunged_uids: with self.syncmanager_lock: common.remove_deleted_uids(