Run operations for closed folders as batch / low priority

pull/172/head
M66B 6 years ago
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) { for (TupleOperationEx op : submit) {
TupleOperationEx.PartitionKey key = op.getPartitionKey(); TupleOperationEx.PartitionKey key = op.getPartitionKey(offline);
if (!partitions.containsKey(key)) if (!partitions.containsKey(key))
partitions.put(key, new ArrayList<>()); partitions.put(key, new ArrayList<>());
partitions.get(key).add(op); partitions.get(key).add(op);

@ -43,11 +43,15 @@ public class TupleOperationEx extends EntityOperation {
return false; return false;
} }
PartitionKey getPartitionKey() { PartitionKey getPartitionKey(boolean offline) {
PartitionKey key = new PartitionKey(); PartitionKey key = new PartitionKey();
key.id = (MOVE.equals(name) || FETCH.equals(name) ? 0 : this.id); if (offline)
key.priority = this.priority; key.priority = this.priority + 10;
key.operation = this.name; else {
key.id = (MOVE.equals(name) || FETCH.equals(name) ? 0 : this.id);
key.priority = this.priority;
key.operation = this.name;
}
return key; return key;
} }
@ -72,7 +76,7 @@ public class TupleOperationEx extends EntityOperation {
PartitionKey other = (PartitionKey) obj; PartitionKey other = (PartitionKey) obj;
return (this.id == other.id && return (this.id == other.id &&
this.priority == other.priority && this.priority == other.priority &&
this.operation.equals(other.operation)); Objects.equals(this.operation, other.operation));
} else } else
return false; return false;
} }

Loading…
Cancel
Save