|
|
@ -1241,7 +1241,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
if (account.protocol != EntityAccount.TYPE_IMAP)
|
|
|
|
if (account.protocol != EntityAccount.TYPE_IMAP)
|
|
|
|
iservice.setLeaveOnServer(account.leave_on_server);
|
|
|
|
iservice.setLeaveOnServer(account.leave_on_server);
|
|
|
|
|
|
|
|
|
|
|
|
final long start = new Date().getTime();
|
|
|
|
final Date lastStillHere = new Date(0);
|
|
|
|
|
|
|
|
|
|
|
|
iservice.setListener(new StoreListener() {
|
|
|
|
iservice.setListener(new StoreListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -1254,11 +1254,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
|
|
|
|
|
|
|
if ("Still here".equals(message) &&
|
|
|
|
if ("Still here".equals(message) &&
|
|
|
|
!account.isTransient(ServiceSynchronize.this)) {
|
|
|
|
!account.isTransient(ServiceSynchronize.this)) {
|
|
|
|
long elapsed = new Date().getTime() - start;
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
|
|
|
long last = lastStillHere.getTime();
|
|
|
|
|
|
|
|
if (last > 0) {
|
|
|
|
|
|
|
|
long elapsed = now - last;
|
|
|
|
if (elapsed < STILL_THERE_THRESHOLD)
|
|
|
|
if (elapsed < STILL_THERE_THRESHOLD)
|
|
|
|
optimizeAccount(account, "'" + message + "'" +
|
|
|
|
optimizeAccount(account, "'" + message + "'" +
|
|
|
|
" elapsed=" + elapsed + " ms");
|
|
|
|
" elapsed=" + elapsed + " ms");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lastStillHere.setTime(now);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
} else
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
wlFolder.acquire();
|
|
|
|
wlFolder.acquire();
|
|
|
@ -1290,6 +1295,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
iservice.connect(account);
|
|
|
|
iservice.connect(account);
|
|
|
|
|
|
|
|
lastStillHere.setTime(0);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
// Immediately report auth errors
|
|
|
|
// Immediately report auth errors
|
|
|
|
if (ex instanceof AuthenticationFailedException) {
|
|
|
|
if (ex instanceof AuthenticationFailedException) {
|
|
|
|