mirror of https://github.com/M66B/FairEmail.git
Run operations for closed folders as batch / low priority
This commit is contained in:
parent
3c995ec3d8
commit
a7acf34321
|
@ -1150,8 +1150,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|||
}
|
||||
});
|
||||
|
||||
boolean offline = (mapFolders.get(folder) == null);
|
||||
for (TupleOperationEx op : submit) {
|
||||
TupleOperationEx.PartitionKey key = op.getPartitionKey();
|
||||
TupleOperationEx.PartitionKey key = op.getPartitionKey(offline);
|
||||
if (!partitions.containsKey(key))
|
||||
partitions.put(key, new ArrayList<>());
|
||||
partitions.get(key).add(op);
|
||||
|
|
|
@ -43,11 +43,15 @@ public class TupleOperationEx extends EntityOperation {
|
|||
return false;
|
||||
}
|
||||
|
||||
PartitionKey getPartitionKey() {
|
||||
PartitionKey getPartitionKey(boolean offline) {
|
||||
PartitionKey key = new PartitionKey();
|
||||
key.id = (MOVE.equals(name) || FETCH.equals(name) ? 0 : this.id);
|
||||
key.priority = this.priority;
|
||||
key.operation = this.name;
|
||||
if (offline)
|
||||
key.priority = this.priority + 10;
|
||||
else {
|
||||
key.id = (MOVE.equals(name) || FETCH.equals(name) ? 0 : this.id);
|
||||
key.priority = this.priority;
|
||||
key.operation = this.name;
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@ -72,7 +76,7 @@ public class TupleOperationEx extends EntityOperation {
|
|||
PartitionKey other = (PartitionKey) obj;
|
||||
return (this.id == other.id &&
|
||||
this.priority == other.priority &&
|
||||
this.operation.equals(other.operation));
|
||||
Objects.equals(this.operation, other.operation));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue