mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-26 16:03:18 +00:00
Prioritize new operations
This commit is contained in:
parent
28b63588b1
commit
ec5e43ffb5
1 changed files with 8 additions and 14 deletions
|
@ -133,17 +133,13 @@ class Core {
|
||||||
Log.i(folder.name + " start process");
|
Log.i(folder.name + " start process");
|
||||||
|
|
||||||
DB db = DB.getInstance(context);
|
DB db = DB.getInstance(context);
|
||||||
List<EntityOperation> ops = db.operation().getOperations(folder.id);
|
while (state.isRunning() && state.isRecoverable()) {
|
||||||
|
List<EntityOperation> ops = db.operation().getOperations(folder.id);
|
||||||
List<Long> processed = new ArrayList<>();
|
Log.i(folder.name + " pending operations=" + ops.size());
|
||||||
Log.i(folder.name + " pending operations=" + ops.size());
|
if (ops.size() == 0)
|
||||||
for (int i = 0; i < ops.size() && state.isRunning() && state.isRecoverable(); i++) {
|
break;
|
||||||
EntityOperation op = ops.get(i);
|
|
||||||
if (processed.contains(op.id)) {
|
|
||||||
Log.i(folder.name + " already processed op=" + op.id + "/" + op.name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
EntityOperation op = ops.get(0);
|
||||||
try {
|
try {
|
||||||
Log.i(folder.name +
|
Log.i(folder.name +
|
||||||
" start op=" + op.id + "/" + op.name +
|
" start op=" + op.id + "/" + op.name +
|
||||||
|
@ -170,7 +166,7 @@ class Core {
|
||||||
|
|
||||||
// Process similar operations
|
// Process similar operations
|
||||||
boolean skip = false;
|
boolean skip = false;
|
||||||
for (int j = i + 1; j < ops.size(); j++) {
|
for (int j = 1; j < ops.size(); j++) {
|
||||||
EntityOperation next = ops.get(j);
|
EntityOperation next = ops.get(j);
|
||||||
|
|
||||||
switch (op.name) {
|
switch (op.name) {
|
||||||
|
@ -198,10 +194,8 @@ class Core {
|
||||||
// Same target
|
// Same target
|
||||||
if (jargs.getLong(0) == jnext.getLong(0)) {
|
if (jargs.getLong(0) == jnext.getLong(0)) {
|
||||||
EntityMessage m = db.message().getMessage(next.message);
|
EntityMessage m = db.message().getMessage(next.message);
|
||||||
if (m != null && m.uid != null) {
|
if (m != null && m.uid != null)
|
||||||
processed.add(next.id);
|
|
||||||
similar.put(next, m);
|
similar.put(next, m);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue