Logaritmic back-off on auth failures

This commit is contained in:
M66B 2021-09-06 11:26:46 +02:00
parent c244e4e0a6
commit bea7334df9
1 changed files with 6 additions and 1 deletions

View File

@ -1401,7 +1401,12 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
} else {
Log.e(ex);
try {
state.setBackoff(2 * CONNECT_BACKOFF_ALARM_MAX * 60);
int backoff = state.getBackoff();
if (backoff < 2 * CONNECT_BACKOFF_ALARM_MAX * 60)
backoff = 2 * CONNECT_BACKOFF_ALARM_MAX * 60;
else if (backoff < 8 * CONNECT_BACKOFF_ALARM_MAX * 60)
backoff *= 2;
state.setBackoff(backoff);
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify("receive:" + account.id,
NotificationHelper.NOTIFICATION_TAGGED,