From ef8e692165fc468e15d808e4bfadec47faf152d1 Mon Sep 17 00:00:00 2001 From: Brandon Martel Date: Sun, 12 Jun 2022 23:17:56 -0500 Subject: [PATCH] fixing worker refetch interval calc --- src/ripple/worker.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ripple/worker.js b/src/ripple/worker.js index bc5b32d..f6f3875 100644 --- a/src/ripple/worker.js +++ b/src/ripple/worker.js @@ -20,8 +20,9 @@ setInterval(() => { f.init = f.init || {} const fetchedAt = f.fetchedAt || 0 const { refetch = 0, ..._init } = f.init - if (Date.now() - refetch > fetchedAt * 1000) { - f.fetchedAt = Date.now() + const now = Date.now() + if (now - refetch * 1000 > fetchedAt) { + f.fetchedAt = now refetchable.set(id, f) fetch(f.input, _init).then(async (res) => { const headers = {}