Serialize account operations, increase IMAP connection pool size to 2

pull/156/head
M66B 6 years ago
parent 5f24921230
commit cf189511e3

@ -119,6 +119,7 @@ public class MessageHelper {
props.put("mail.imaps.timeout", Integer.toString(READ_TIMEOUT));
props.put("mail.imaps.connectionpool.debug", "true");
props.put("mail.imaps.connectionpoolsize", "2");
props.put("mail.imaps.connectionpooltimeout", Integer.toString(POOL_TIMEOUT));
props.put("mail.imaps.finalizecleanclose", "false");
@ -146,6 +147,7 @@ public class MessageHelper {
props.put("mail.imap.timeout", Integer.toString(READ_TIMEOUT));
props.put("mail.imap.connectionpool.debug", "true");
props.put("mail.imap.connectionpoolsize", "2");
props.put("mail.imap.connectionpooltimeout", Integer.toString(POOL_TIMEOUT));
props.put("mail.imap.finalizecleanclose", "false");

@ -96,7 +96,6 @@ 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;
@ -697,7 +696,7 @@ public class ServiceSynchronize extends LifecycleService {
Core.onSynchronizeFolders(this, account, istore, state);
// Open synchronizing folders
final ExecutorService pollExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
final ExecutorService executor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
for (final EntityFolder folder : folders) {
if (folder.synchronize && !folder.poll && capIdle) {
Log.i(account.name + " sync folder " + folder.name);
@ -916,7 +915,6 @@ public class ServiceSynchronize extends LifecycleService {
db.operation().liveOperations(folder.id).observe(cowner, new Observer<List<EntityOperation>>() {
private List<Long> handling = new ArrayList<>();
private final ExecutorService folderExecutor = Executors.newSingleThreadExecutor(Helper.backgroundThreadFactory);
private final PowerManager.WakeLock wlFolder = pm.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, BuildConfig.APPLICATION_ID + ":folder." + folder.id);
@ -935,14 +933,6 @@ public class ServiceSynchronize extends LifecycleService {
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() {

Loading…
Cancel
Save