From 4f45c27e8f5ed3deadf29262977e6d67cfed72c1 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 24 Sep 2020 08:20:09 +0200 Subject: [PATCH] Added processing state --- app/src/main/java/eu/faircode/email/Core.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 1665d2d159..98b2c67790 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -4066,6 +4066,7 @@ class Core { private boolean recoverable = true; private Long lastActivity = null; + private boolean process = false; private Map sequence = new HashMap<>(); private Map batch = new HashMap<>(); @@ -4149,9 +4150,11 @@ class Core { recoverable = true; lastActivity = null; resetBatches(); + process = true; } void resetBatches() { + process = false; synchronized (this) { for (FolderPriority key : sequence.keySet()) { batch.put(key, sequence.get(key)); @@ -4247,6 +4250,11 @@ class Core { } boolean batchCanRun(long folder, int priority, long current) { + if (!process) { + Log.i("=== Can " + folder + ":" + priority + " process=" + process); + return false; + } + synchronized (this) { FolderPriority key = new FolderPriority(folder, priority); boolean can = batch.get(key).equals(current);