Added processing state

This commit is contained in:
M66B 2020-09-24 08:20:09 +02:00
parent 5d3900553d
commit 4f45c27e8f
1 changed files with 8 additions and 0 deletions

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);