|
|
@ -2315,7 +2315,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
|
|
|
|
|
|
|
|
if (state.isRunning()) {
|
|
|
|
if (state.isRunning()) {
|
|
|
|
long now = new Date().getTime();
|
|
|
|
long now = new Date().getTime();
|
|
|
|
|
|
|
|
boolean logarithmic_backoff = prefs.getBoolean("logarithmic_backoff", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (logarithmic_backoff) {
|
|
|
|
// Check for fast successive server, connectivity, etc failures
|
|
|
|
// Check for fast successive server, connectivity, etc failures
|
|
|
|
long poll_interval = Math.min(account.poll_interval, CONNECT_BACKOFF_ALARM_START);
|
|
|
|
long poll_interval = Math.min(account.poll_interval, CONNECT_BACKOFF_ALARM_START);
|
|
|
|
long fail_threshold = poll_interval * 60 * 1000L * FAST_FAIL_THRESHOLD / 100;
|
|
|
|
long fail_threshold = poll_interval * 60 * 1000L * FAST_FAIL_THRESHOLD / 100;
|
|
|
@ -2362,18 +2364,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
fast_fails = 0;
|
|
|
|
fast_fails = 0;
|
|
|
|
first_fail = 0;
|
|
|
|
first_fail = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int backoff = state.getBackoff();
|
|
|
|
int backoff = state.getBackoff();
|
|
|
|
int recently = (lastLost + LOST_RECENTLY < now ? 1 : 2);
|
|
|
|
int recently = (lastLost + LOST_RECENTLY < now ? 1 : 2);
|
|
|
|
boolean logarithmic_backoff = prefs.getBoolean("logarithmic_backoff", true);
|
|
|
|
|
|
|
|
EntityLog.log(this, EntityLog.Type.Account, account,
|
|
|
|
EntityLog.log(this, EntityLog.Type.Account, account,
|
|
|
|
account.name + " backoff=" + backoff +
|
|
|
|
account.name + " backoff=" + backoff +
|
|
|
|
" recently=" + recently + "x" +
|
|
|
|
" recently=" + recently + "x" +
|
|
|
|
" logarithmic=" + logarithmic_backoff);
|
|
|
|
" logarithmic=" + logarithmic_backoff);
|
|
|
|
|
|
|
|
|
|
|
|
if (!logarithmic_backoff)
|
|
|
|
if (logarithmic_backoff) {
|
|
|
|
backoff = CONNECT_BACKOFF_START;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (backoff < CONNECT_BACKOFF_MAX)
|
|
|
|
if (backoff < CONNECT_BACKOFF_MAX)
|
|
|
|
state.setBackoff(backoff * 2);
|
|
|
|
state.setBackoff(backoff * 2);
|
|
|
|
else if (backoff == CONNECT_BACKOFF_MAX)
|
|
|
|
else if (backoff == CONNECT_BACKOFF_MAX)
|
|
|
@ -2389,6 +2389,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
b = CONNECT_BACKOFF_ALARM_MAX * 60;
|
|
|
|
b = CONNECT_BACKOFF_ALARM_MAX * 60;
|
|
|
|
state.setBackoff(b);
|
|
|
|
state.setBackoff(b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Linear back-off
|
|
|
|
|
|
|
|
int b = backoff + 60;
|
|
|
|
|
|
|
|
if (b > CONNECT_BACKOFF_ALARM_MAX * 60)
|
|
|
|
|
|
|
|
b = CONNECT_BACKOFF_ALARM_MAX * 60;
|
|
|
|
|
|
|
|
state.setBackoff(b);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (backoff <= CONNECT_BACKOFF_MAX) {
|
|
|
|
if (backoff <= CONNECT_BACKOFF_MAX) {
|
|
|
|
// Short back-off period, keep device awake
|
|
|
|
// Short back-off period, keep device awake
|
|
|
|