From a99dd7cd17e2e95c02122093c07cb8190aac25fb Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 12 Mar 2022 23:20:21 +0100 Subject: [PATCH] Linear backoff: 1 and 5 min --- FAQ.md | 5 +++-- app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FAQ.md b/FAQ.md index 3dd11aa2cd..fb5da81814 100644 --- a/FAQ.md +++ b/FAQ.md @@ -3448,10 +3448,11 @@ FairEmail will retry one time after waiting 8 seconds while keeping the device a If this fails, FairEmail will schedule an alarm to retry after 5, 15, 30 and eventually every 60 minutes and let the device sleep (=no battery usage). By temporarily enabling debug mode in the miscellaneous settings, you can disable this logarithmic back-off scheme (since version 1.1855). -This will result in using a linear back-off scheme, which means that after each successive failure the waiting time will be increased by 1 minute up to 60 minutes. +This will result in using a linear back-off scheme, which means that after each successive failure the waiting time will be +increased by 1 minute the first 5 minutes and thereafter by 5 minutes up to 60 minutes. Note that [Android doze mode](https://developer.android.com/training/monitoring-device-state/doze-standby) -does not allow to wake the device earlier than after 15 minutes when doze mode is enabled. +does not allow to wake the device earlier than after 15 minutes when doze mode is active. *Force sync* in the three-dots menu of the unified inbox can be used to let FairEmail attempt to reconnect without waiting. diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 41a291239e..bdff80d1d2 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -2391,7 +2391,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } } else { // Linear back-off - int b = backoff + 60; + int b = backoff + (backoff < CONNECT_BACKOFF_INTERMEDIATE * 60 ? 60 : 5 * 60); if (b > CONNECT_BACKOFF_ALARM_MAX * 60) b = CONNECT_BACKOFF_ALARM_MAX * 60; state.setBackoff(b);