From 5f02a6749231ee9c849a96b149208972dfe398ff Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:09:16 -0500 Subject: [PATCH] Add 5% jitter to CheckScheduler Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> --- ts/util/CheckScheduler.preload.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ts/util/CheckScheduler.preload.ts b/ts/util/CheckScheduler.preload.ts index 01572e5f6d..e189514ce6 100644 --- a/ts/util/CheckScheduler.preload.ts +++ b/ts/util/CheckScheduler.preload.ts @@ -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();