From 2a9f7c3b207e2c2f3d0118d5aadb818f9202f266 Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 29 Dec 2021 20:56:02 +0100 Subject: [PATCH] Optimize sync folders --- app/src/main/java/eu/faircode/email/Core.java | 4 +++- .../main/java/eu/faircode/email/ServiceSynchronize.java | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index df9de76c00..a47a7453b4 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2032,8 +2032,10 @@ class Core { Log.i(account.name + " sync folders=" + sync_folders + " poll=" + sync_folders_poll + " shared=" + sync_shared_folders + " force=" + force); - if (force || (keep_alive && sync_folders_poll)) + if (force) sync_folders = true; + if (keep_alive) + sync_folders = sync_folders_poll; if (!sync_folders) sync_shared_folders = false; diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 83043022cc..0b0a2a7cbf 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -2047,9 +2047,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences " poll count=" + folder.poll_count + " factor=" + folder.poll_factor); } - Core.onSynchronizeFolders(this, - account, iservice.getStore(), state, - true, false); + if (!first) + Core.onSynchronizeFolders(this, + account, iservice.getStore(), state, + true, false); } } catch (Throwable ex) { if (tune) {