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