Cleanup orphaned messages

This commit is contained in:
M66B 2019-01-07 08:19:48 +00:00
parent fd405deea7
commit 0136ddfa30
2 changed files with 8 additions and 0 deletions

View File

@ -332,6 +332,11 @@ public interface DaoMessage {
" AND NOT uid IS NULL")
int deleteLocalMessages(long folder);
@Query("DELETE FROM message" +
" WHERE folder = :folder" +
" AND uid IS NULL")
int deleteOrphans(long folder);
@Query("DELETE FROM message" +
" WHERE folder = :folder" +
" AND seen")

View File

@ -2234,6 +2234,9 @@ public class ServiceSynchronize extends LifecycleService {
}
}
// Delete not synchronized messages without uid
db.message().deleteOrphans(folder.id);
db.folder().setFolderSyncState(folder.id, "downloading");
//fp.add(IMAPFolder.FetchProfileItem.MESSAGE);