1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-28 02:37:16 +00:00

Short compensate for quick fails

This commit is contained in:
M66B 2020-10-30 09:22:14 +01:00
parent c6243c1bd3
commit ac737030c5

View file

@ -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);
}
}