Revert "Revert "Fixed POP3 cleanup""

This reverts commit 4ec865a658.
This commit is contained in:
M66B 2023-09-13 12:57:27 +02:00
parent 4ec865a658
commit ef986de622
2 changed files with 4 additions and 5 deletions

View File

@ -161,7 +161,6 @@ class Core {
private static final int FIND_RETRY_COUNT = 3; // times private static final int FIND_RETRY_COUNT = 3; // times
private static final long FIND_RETRY_DELAY = 5 * 1000L; // milliseconds private static final long FIND_RETRY_DELAY = 5 * 1000L; // milliseconds
private static final int POP3_KEEP_EXTRA = 100; // messages private static final int POP3_KEEP_EXTRA = 100; // messages
private static final long POP3_KEEP_DELETED = 3 * 24 * 3600 * 1000L; // milliseconds
private static final Map<Long, List<EntityIdentity>> accountIdentities = new HashMap<>(); private static final Map<Long, List<EntityIdentity>> accountIdentities = new HashMap<>();
@ -3646,9 +3645,10 @@ class Core {
} }
if (account.max_messages != null && !account.leave_on_device) { if (account.max_messages != null && !account.leave_on_device) {
int hidden = db.message().setMessagesUiHide(folder.id, Math.abs(account.max_messages)); int hidden = db.message().setMessagesUiHide(folder.id,
Math.abs(account.max_messages) + flagged);
int deleted = db.message().deleteMessagesKeep(folder.id, int deleted = db.message().deleteMessagesKeep(folder.id,
Math.abs(account.max_messages) + flagged + POP3_KEEP_EXTRA, new Date().getTime() - POP3_KEEP_DELETED); Math.abs(account.max_messages) + flagged + POP3_KEEP_EXTRA);
EntityLog.log(context, account.name + " POP" + EntityLog.log(context, account.name + " POP" +
" cleanup max=" + account.max_messages + " cleanup max=" + account.max_messages +
" hidden=" + hidden + " hidden=" + hidden +

View File

@ -1028,8 +1028,7 @@ public interface DaoMessage {
" AND id NOT IN (" + " AND id NOT IN (" +
" SELECT id FROM message" + " SELECT id FROM message" +
" WHERE folder = :folder" + " WHERE folder = :folder" +
" AND stored < :before" +
" ORDER BY received DESC" + " ORDER BY received DESC" +
" LIMIT :keep)") " LIMIT :keep)")
int deleteMessagesKeep(long folder, int keep, long before); int deleteMessagesKeep(long folder, int keep);
} }