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 <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2018-12-09 02:36:27 +01:00
parent 698ec64319
commit a51064e83a

View File

@ -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):