cap exponential backoff at 300s (10 attempts)

This commit is contained in:
Daniel Gultsch 2016-05-16 19:58:24 +02:00
parent 331cbf3696
commit d7c5264ad0
1 changed files with 1 additions and 1 deletions

View File

@ -1422,7 +1422,7 @@ public class XmppConnection implements Runnable {
} }
public int getTimeToNextAttempt() { public int getTimeToNextAttempt() {
final int interval = (int) (25 * Math.pow(1.5, attempt)); final int interval = Math.min((int) (25 * Math.pow(1.3, attempt)), 300);
final int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000); final int secondsSinceLast = (int) ((SystemClock.elapsedRealtime() - this.lastConnect) / 1000);
return interval - secondsSinceLast; return interval - secondsSinceLast;
} }