From a51064e83a82c42fce9cee987a9132c337c8a225 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sun, 9 Dec 2018 02:36:27 +0100 Subject: [PATCH] maxage: always compute the remote cache list for min_uid Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/581 Tested-by: https://github.com/ianbrody Signed-off-by: Nicolas Sebrecht --- offlineimap/accounts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/offlineimap/accounts.py b/offlineimap/accounts.py index 6418a8c..4aca7c4 100644 --- a/offlineimap/accounts.py +++ b/offlineimap/accounts.py @@ -511,6 +511,11 @@ def syncfolder(account, remotefolder, quick): uids = remotefolder.getmessageuidlist() localfolder.dropmessagelistcache() if len(uids) > 0: + # Reload the remote message list from min_uid. This avoid issues for + # old messages, which has been added from local on any previous run + # (IOW, message is older than maxage _and_ has high enough UID). + remotefolder.dropmessagelistcache() + remotefolder.cachemessagelist(min_uid=min(uids)) localfolder.cachemessagelist(min_uid=min(uids)) else: # Remote folder UIDs list is empty for the given range. We still @@ -523,6 +528,7 @@ def syncfolder(account, remotefolder, quick): uids = [uid for uid in uids if uid > 0] if len(uids) > 0: # Update the remote cache list for this new min(uids). + remotefolder.dropmessagelistcache() remotefolder.cachemessagelist(min_uid=min(uids)) def cachemessagelists_startdate(new, partial, date):