1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-25 01:06:04 +00:00

Added processing state

This commit is contained in:
M66B 2020-09-24 08:20:09 +02:00
parent 5d3900553d
commit 4f45c27e8f

View file

@ -4066,6 +4066,7 @@ class Core {
private boolean recoverable = true;
private Long lastActivity = null;
private boolean process = false;
private Map<FolderPriority, Long> sequence = new HashMap<>();
private Map<FolderPriority, Long> 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);