cap exponential backoff at 300s (10 attempts)
This commit is contained in:
parent
331cbf3696
commit
d7c5264ad0
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue