Defer download on initialize

pull/157/head
M66B 5 years ago
parent d28635d13a
commit 6926933094

@ -1237,7 +1237,7 @@ class Core {
int count = ifolder.getMessageCount();
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);
if (download) {
if (download && folder.initialize == 0) {
db.folder().setFolderSyncState(folder.id, "downloading");
// Download messages/attachments
@ -1274,9 +1274,21 @@ class Core {
}
}
if (state.running) {
if (state.running && folder.initialize != 0) {
folder.initialize = 0;
db.folder().setFolderInitialize(folder.id, 0);
// Schedule download
if (download) {
EntityOperation operation = new EntityOperation();
operation.account = folder.account;
operation.folder = folder.id;
operation.message = null;
operation.name = EntityOperation.SYNC;
operation.args = jargs.toString();
operation.created = new Date().getTime();
operation.id = db.operation().insertOperation(operation);
}
}
db.folder().setFolderSync(folder.id, new Date().getTime());

@ -191,7 +191,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
}
JSONArray jargs = new JSONArray();
jargs.put(initialize == 0 ? days : Math.max(keep_days, initialize));
jargs.put(initialize == 0 ? days : Math.min(keep_days, initialize));
jargs.put(keep_days);
jargs.put(download);
jargs.put(auto_delete);

Loading…
Cancel
Save