From 3c417d3a0235696a893005d5aa257acb90600b11 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 23 Sep 2020 22:08:08 +0200 Subject: [PATCH] Fast close --- .../eu/faircode/email/ServiceSynchronize.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 95ef965965..5c07e94497 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1615,21 +1615,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences state.resetBatches(); ((ThreadPoolExecutor) executor).getQueue().clear(); - // Close 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 + // Close store/folders try { EntityLog.log(this, account.name + " store closing"); iservice.close(); @@ -1638,6 +1624,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Log.w(account.name, ex); } finally { EntityLog.log(this, account.name + " closed"); + for (EntityFolder folder : mapFolders.keySet()) + db.folder().setFolderState(folder.id, null); db.account().setAccountState(account.id, null); }