mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-07-07 22:05:40 +01:00
Add 5% jitter to CheckScheduler
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
@@ -83,7 +83,10 @@ export class CheckScheduler {
|
||||
// Gracefully rollout when polling initially
|
||||
now - this.#options.interval * Math.random()
|
||||
);
|
||||
const targetTimestamp = lastCheckTimestamp + this.#options.interval;
|
||||
// Schedule check out by the interval +-5% jitter
|
||||
const targetTimestamp =
|
||||
lastCheckTimestamp +
|
||||
this.#options.interval * (1 + (Math.random() * 0.1 - 0.05));
|
||||
const delay = Math.max(0, targetTimestamp - now);
|
||||
if (this.#timer != null) {
|
||||
this.#timer.clear();
|
||||
|
||||
Reference in New Issue
Block a user