mirror of https://github.com/M66B/FairEmail.git
Yield after message/batch
This commit is contained in:
parent
b465cfa165
commit
911391ea2f
|
@ -1542,6 +1542,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
db.beginTransaction();
|
db.beginTransaction();
|
||||||
ids[from + j] = synchronizeMessage(this, folder, ifolder, (IMAPMessage) isub[j], false);
|
ids[from + j] = synchronizeMessage(this, folder, ifolder, (IMAPMessage) isub[j], false);
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
|
Thread.sleep(20);
|
||||||
} catch (MessageRemovedException ex) {
|
} catch (MessageRemovedException ex) {
|
||||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||||
} catch (FolderClosedException ex) {
|
} catch (FolderClosedException ex) {
|
||||||
|
@ -1555,6 +1556,11 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
// Reduce memory usage
|
// Reduce memory usage
|
||||||
((IMAPMessage) isub[j]).invalidateHeaders();
|
((IMAPMessage) isub[j]).invalidateHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
db.folder().setFolderState(folder.id, "downloading");
|
db.folder().setFolderState(folder.id, "downloading");
|
||||||
|
@ -1573,8 +1579,10 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
for (int j = isub.length - 1; j >= 0; j--)
|
for (int j = isub.length - 1; j >= 0; j--)
|
||||||
try {
|
try {
|
||||||
//Log.i(Helper.TAG, folder.name + " download index=" + (from + j) + " id=" + ids[from + j]);
|
//Log.i(Helper.TAG, folder.name + " download index=" + (from + j) + " id=" + ids[from + j]);
|
||||||
if (ids[from + j] != null)
|
if (ids[from + j] != null) {
|
||||||
downloadMessage(this, folder, ifolder, (IMAPMessage) isub[j], ids[from + j]);
|
downloadMessage(this, folder, ifolder, (IMAPMessage) isub[j], ids[from + j]);
|
||||||
|
Thread.sleep(20);
|
||||||
|
}
|
||||||
} catch (FolderClosedException ex) {
|
} catch (FolderClosedException ex) {
|
||||||
throw ex;
|
throw ex;
|
||||||
} catch (FolderClosedIOException ex) {
|
} catch (FolderClosedIOException ex) {
|
||||||
|
@ -1585,6 +1593,11 @@ public class ServiceSynchronize extends LifecycleService {
|
||||||
// Free memory
|
// Free memory
|
||||||
((IMAPMessage) isub[j]).invalidateHeaders();
|
((IMAPMessage) isub[j]).invalidateHeaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(100);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue