Fast close

This commit is contained in:
M66B 2020-09-23 22:08:08 +02:00
parent e6e5d5e9aa
commit 3c417d3a02
1 changed files with 3 additions and 15 deletions

View File

@ -1615,21 +1615,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
state.resetBatches(); state.resetBatches();
((ThreadPoolExecutor) executor).getQueue().clear(); ((ThreadPoolExecutor) executor).getQueue().clear();
// Close folders // Close store/folders
for (EntityFolder folder : mapFolders.keySet())
if (folder.synchronize && !folder.poll && mapFolders.get(folder) != null) {
db.folder().setFolderState(folder.id, "closing");
try {
if (iservice.getStore().isConnected())
mapFolders.get(folder).close();
} catch (Throwable ex) {
Log.w(ex);
} finally {
db.folder().setFolderState(folder.id, null);
}
}
// Close store
try { try {
EntityLog.log(this, account.name + " store closing"); EntityLog.log(this, account.name + " store closing");
iservice.close(); iservice.close();
@ -1638,6 +1624,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
Log.w(account.name, ex); Log.w(account.name, ex);
} finally { } finally {
EntityLog.log(this, account.name + " closed"); EntityLog.log(this, account.name + " closed");
for (EntityFolder folder : mapFolders.keySet())
db.folder().setFolderState(folder.id, null);
db.account().setAccountState(account.id, null); db.account().setAccountState(account.id, null);
} }