Skip to content

Commit

Permalink
fixing worker refetch interval calc
Browse files Browse the repository at this point in the history
  • Loading branch information
bmartel committed Jun 13, 2022
1 parent cccd7eb commit ef8e692
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ripple/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down

0 comments on commit ef8e692

Please sign in to comment.