mirror of https://github.com/M66B/FairEmail.git
Serialize sync on init
This commit is contained in:
parent
4b832db3fc
commit
e52b52b2ba
|
@ -1188,8 +1188,10 @@ class Core {
|
|||
}
|
||||
}
|
||||
|
||||
if (state.running)
|
||||
if (state.running) {
|
||||
folder.initialize = false;
|
||||
db.folder().setFolderInitialized(folder.id);
|
||||
}
|
||||
|
||||
db.folder().setFolderSync(folder.id, new Date().getTime());
|
||||
db.folder().setFolderError(folder.id, null);
|
||||
|
|
|
@ -96,6 +96,7 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
private long lastLost = 0;
|
||||
private TupleAccountStats lastStats = new TupleAccountStats();
|
||||
private ExecutorService queue = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
private ExecutorService initExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
|
||||
|
||||
private static boolean booted = false;
|
||||
private static boolean oneshot = false;
|
||||
|
@ -931,8 +932,18 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
handling = ops;
|
||||
|
||||
if (handling.size() > 0 && process) {
|
||||
Log.i(folder.name + " operations=" + operations.size());
|
||||
(folder.poll ? pollExecutor : folderExecutor).submit(new Runnable() {
|
||||
Log.i(folder.name + " operations=" + operations.size() +
|
||||
" init=" + folder.initialize + " poll=" + folder.poll);
|
||||
|
||||
ExecutorService executor;
|
||||
if (folder.initialize)
|
||||
executor = initExecutor;
|
||||
else if (folder.poll)
|
||||
executor = pollExecutor;
|
||||
else
|
||||
executor = folderExecutor;
|
||||
|
||||
executor.submit(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue