kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add jitter to job exponential backoff.
rodzic
93e9dd6425
commit
8f7fe5c3ee
|
@ -456,6 +456,9 @@ class JobController {
|
||||||
int boundedAttempt = Math.min(nextAttempt, 30);
|
int boundedAttempt = Math.min(nextAttempt, 30);
|
||||||
long exponentialBackoff = (long) Math.pow(2, boundedAttempt) * 1000;
|
long exponentialBackoff = (long) Math.pow(2, boundedAttempt) * 1000;
|
||||||
long actualBackoff = Math.min(exponentialBackoff, maxBackoff);
|
long actualBackoff = Math.min(exponentialBackoff, maxBackoff);
|
||||||
|
double jitter = 0.75 + (Math.random() * 0.5);
|
||||||
|
|
||||||
|
actualBackoff = (long) (actualBackoff * jitter);
|
||||||
|
|
||||||
return currentTime + actualBackoff;
|
return currentTime + actualBackoff;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue