From 9155b1c9fe1aeaebab80d8e9504128106690f39f Mon Sep 17 00:00:00 2001 From: Andrea Vos Date: Wed, 25 Jan 2023 21:58:04 +0100 Subject: [PATCH] [profile] #290 generic rel=me (links table) - minor fixes --- server/analyseLinks.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/analyseLinks.js b/server/analyseLinks.js index 945c7b5e6..ed8b1bda6 100644 --- a/server/analyseLinks.js +++ b/server/analyseLinks.js @@ -11,7 +11,7 @@ const timer = ms => new Promise( res => setTimeout(res, ms)); const analyser = new LinkAnalyser(); const db = await dbConnection(); while (true) { - const chunk = await db.all(SQL`SELECT url FROM links WHERE (expiresAt IS NULL OR expiresAt <= ${new Date() / 1000}) LIMIT 16`); + const chunk = await db.all(SQL`SELECT url FROM links WHERE (expiresAt IS NULL OR expiresAt <= ${new Date() / 1000}) LIMIT 64`); console.log(`Fetching ${chunk.length} links: (${chunk.map(l => l.url).join(', ')})`); if (chunk.length === 0) { await timer(1000); @@ -20,10 +20,10 @@ const timer = ms => new Promise( res => setTimeout(res, ms)); const results = await Promise.all(chunk.map(({url}) => analyser.analyse(url))); for (let result of results) { if (result.error) { - await db.get(SQL`UPDATE links SET expiresAt = ${(new Date() / 1000) + 7*24*60*60} WHERE url=${result.url}`); + await db.get(SQL`UPDATE links SET expiresAt = ${parseInt(new Date() / 1000) + 7*24*60*60} WHERE url=${result.url}`); } else { await db.get(SQL`UPDATE links - SET expiresAt = ${(new Date() / 1000) + 7*24*60*60}, + SET expiresAt = ${parseInt(new Date() / 1000) + 7*24*60*60}, favicon = ${result.favicon}, relMe = ${JSON.stringify(result.relMe)}, nodeinfo = ${JSON.stringify(result.nodeinfo)}