From 86e16fc56f7d8377952222bd9a277fb2eaffb537 Mon Sep 17 00:00:00 2001 From: dakedres Date: Sat, 10 Feb 2024 18:21:13 -0700 Subject: [PATCH] Fixed delayed fetch & improved logging --- lib.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib.js b/lib.js index c762f3c..e157292 100644 --- a/lib.js +++ b/lib.js @@ -110,13 +110,14 @@ export async function fetchRss(source) { } catch(err) { error = err } - + source.errored = error !== undefined || !response.ok if(source.errored) { source.error = error ?? createNetworkingError(response) source.rss = '' } else { source.rss = await response.text() + console.log(`Found ${source.name} at ${hostname}`) } return source @@ -130,11 +131,11 @@ export const delayedFetch = async (url, options, courtesyWait = 5 * 1000) => { let now = Date.now() if(timeout == null || timeout <= now) { - waitingList.set(domain, timeout + courtesyWait) } else { await sleep(timeout - now) } + waitingList.set(domain, now + courtesyWait) return await fetch(url, options) } @@ -655,6 +656,12 @@ export const nitter = { // https://mastodon.social/@brownpau.rss (note the "@")" // - https://mastodon.social/@brownpau/100523448408374430 +export const mastodon = { + createSource(user, instances, courtesyWait, postReducerCallback, cache) { + + } +} + export const platforms = { tumblr, nitter