Explicitly cancel operations on failure

This commit is contained in:
M66B 2020-03-04 09:24:24 +01:00
parent 3cece148c0
commit b68cb942d2
2 changed files with 9 additions and 2 deletions

View File

@ -149,8 +149,8 @@ class Core {
boolean group = true;
Log.i(folder.name + " executing operations=" + ops.size());
while (retry < LOCAL_RETRY_MAX && ops.size() > 0 &&
state.batchCanRun(folder.id, priority, sequence) &&
state.isRunning() && ifolder.isOpen()) {
state.isRunning() &&
state.batchCanRun(folder.id, priority, sequence)) {
TupleOperationEx op = ops.get(0);
try {
@ -3471,6 +3471,10 @@ class Core {
void reset() {
recoverable = true;
lastActivity = null;
resetBatches();
}
void resetBatches() {
synchronized (this) {
for (FolderPriority key : sequence.keySet()) {
batch.put(key, sequence.get(key));

View File

@ -1486,6 +1486,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
}
});
// Cancel running operations
state.resetBatches();
// Close folders
for (EntityFolder folder : mapFolders.keySet())
if (folder.synchronize && !folder.poll && mapFolders.get(folder) != null) {