Reset failed foreground sync

pull/152/head
M66B 5 years ago
parent e71f6d5db1
commit f80d6c683b

@ -222,7 +222,7 @@ class Core {
if (ex instanceof MessageRemovedException ||
ex instanceof FolderNotFoundException ||
ex instanceof IllegalArgumentException) {
Log.w("Unrecoverable", ex);
Log.w("Unrecoverable");
// There is no use in repeating
db.operation().deleteOperation(op.id);
@ -254,12 +254,18 @@ class Core {
} else if (ex instanceof MessagingException) {
// Socket timeout is a recoverable condition (send message)
if (ex.getCause() instanceof SocketTimeoutException) {
Log.w("Recoverable", ex);
Log.w("Recoverable");
// No need to inform user
return;
}
}
if (EntityOperation.SYNC.equals(op.name) && jargs.getBoolean(3) /* foreground */) {
Log.w("Deleting foreground SYNC");
db.operation().deleteOperation(op.id);
db.folder().setFolderSyncState(folder.id, null);
}
throw ex;
}
} finally {

@ -228,11 +228,14 @@ public class EntityOperation {
if (folder.account != null)
account = db.account().getAccount(folder.account);
JSONArray jargs = folder.getSyncArgs();
jargs.put(foreground);
EntityOperation operation = new EntityOperation();
operation.folder = folder.id;
operation.message = null;
operation.name = SYNC;
operation.args = folder.getSyncArgs().toString();
operation.args = jargs.toString();
operation.created = new Date().getTime();
operation.id = db.operation().insertOperation(operation);

Loading…
Cancel
Save