Always short backoff on charging

This commit is contained in:
M66B
2020-10-31 10:27:42 +01:00
parent 82200c8acb
commit d5baa93a48
3 changed files with 20 additions and 4 deletions

View File

@@ -1711,7 +1711,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
long fail_threshold = account.poll_interval * 60 * 1000L * 2 / 3;
if (account.last_connected == null ||
now - account.last_connected < fail_threshold) {
if (state.getBackoff() == CONNECT_BACKOFF_START) {
if (state.getBackoff() == CONNECT_BACKOFF_START &&
!Helper.isCharging(this)) {
fast_fails++;
if (fast_fails == 1)
first_fail = now;
@@ -1838,9 +1839,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
if (backoff < max)
state.setBackoff(backoff * 2);
else if (backoff == max)
state.setBackoff(CONNECT_BACKOFF_ALARM_START * 60);
else if (backoff < CONNECT_BACKOFF_ALARM_MAX * 60)
else if (backoff == max) {
if (!Helper.isCharging(this))
state.setBackoff(CONNECT_BACKOFF_ALARM_START * 60);
} else if (backoff < CONNECT_BACKOFF_ALARM_MAX * 60)
state.setBackoff(backoff * 2);
}