diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 2956ceeb31..a2c10ca137 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -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); diff --git a/app/src/main/java/eu/faircode/email/TupleOperationEx.java b/app/src/main/java/eu/faircode/email/TupleOperationEx.java index a887b45f82..9bc2bf4e67 100644 --- a/app/src/main/java/eu/faircode/email/TupleOperationEx.java +++ b/app/src/main/java/eu/faircode/email/TupleOperationEx.java @@ -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; }