From ac737030c567d13ab999d109c03bc1f799564c37 Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 30 Oct 2020 09:22:14 +0100 Subject: [PATCH] Short compensate for quick fails --- app/src/main/java/eu/faircode/email/ServiceSynchronize.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 98fb2b8413..7503e20d9b 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -1717,9 +1717,14 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences long missing = (fail_threshold - avg_fail) * fast_fails; int compensate = (int) (missing / (CONNECT_BACKOFF_ALARM_START * 60 * 1000L)); if (compensate > 0) { + if (account.last_connected != null && + now - account.last_connected < 60 * 1000L) + compensate = 1; + int backoff = compensate * CONNECT_BACKOFF_ALARM_START; if (backoff > CONNECT_BACKOFF_ALARM_MAX) backoff = CONNECT_BACKOFF_ALARM_MAX; + String msg = "Fast" + " fails=" + fast_fails + " first=" + ((now - first_fail) / 1000L) + @@ -1731,6 +1736,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences " ex=" + Log.formatThrowable(last_fail, false); Log.e(msg); EntityLog.log(this, msg); + state.setBackoff(backoff * 60); } }