From efe5087d937ac94de25793104a4c19a43cfc0dc3 Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Sat, 13 Sep 2025 17:21:23 +0200 Subject: [PATCH] Jitter tweaks --- lib/async.ts | 4 ++-- web/space.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/async.ts b/lib/async.ts index eb1bb551..ed3e30fc 100644 --- a/lib/async.ts +++ b/lib/async.ts @@ -154,6 +154,6 @@ export function safeRun(fn: () => Promise) { /** * Generates a random delay between 0 and 1000 milliseconds. */ -export function jitter() { - return Math.floor(Math.random() * 1000); +export function jitter(maxLength = 1000) { + return Math.floor(Math.random() * maxLength); } diff --git a/web/space.ts b/web/space.ts index 4eec2113..c2ce21fb 100644 --- a/web/space.ts +++ b/web/space.ts @@ -10,7 +10,7 @@ import { type Path, } from "@silverbulletmd/silverbullet/lib/ref"; -const pageWatchInterval = 4000; +const pageWatchInterval = 3000; // + jitter export class Space { // We do watch files in the background to detect changes