Shutdown operations queue

This commit is contained in:
M66B
2020-01-30 17:05:15 +01:00
parent 586033fa7f
commit 16aa183b3f
2 changed files with 24 additions and 4 deletions

View File

@@ -825,6 +825,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
final ExecutorService executor =
Helper.getBackgroundExecutor(1, "account_" + account.id);
final Map<EntityFolder, IMAPFolder> mapFolders = new HashMap<>();
List<Thread> idlers = new ArrayList<>();
try {
@@ -944,9 +947,6 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
Core.onSynchronizeFolders(this, account, iservice.getStore(), state);
// Open synchronizing folders
final ExecutorService executor =
Helper.getBackgroundExecutor(1, "account_" + account.id);
List<EntityFolder> folders = db.folder().getFolders(account.id, false, true);
Collections.sort(folders, new Comparator<EntityFolder>() {
@Override
@@ -1416,6 +1416,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
executor.shutdown();
// Close folders
for (EntityFolder folder : mapFolders.keySet())
if (folder.synchronize && !folder.poll && mapFolders.get(folder) != null) {