mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Fix exponential backoff retry limits.
This commit is contained in:
parent
c77daa8226
commit
1e564b6ad1
@ -344,7 +344,11 @@ class JobController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private long calculateNextRunAttemptTime(long currentTime, int nextAttempt, long maxBackoff) {
|
private long calculateNextRunAttemptTime(long currentTime, int nextAttempt, long maxBackoff) {
|
||||||
return currentTime + Math.min((long) Math.pow(2, nextAttempt) * 1000, maxBackoff);
|
int boundedAttempt = Math.min(nextAttempt, 30);
|
||||||
|
long exponentialBackoff = (long) Math.pow(2, boundedAttempt) * 1000;
|
||||||
|
long actualBackoff = Math.min(exponentialBackoff, maxBackoff);
|
||||||
|
|
||||||
|
return currentTime + actualBackoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Callback {
|
interface Callback {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user