Add 5% jitter to CheckScheduler

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-06-09 14:09:16 -05:00
committed by GitHub
parent 727bea774c
commit 5f02a67492
+4 -1
View File
@@ -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();