From 9c99b9026c8e25a5edbf45ec177a3e67042e9ab6 Mon Sep 17 00:00:00 2001 From: fatchan Date: Tue, 2 Jul 2019 22:28:46 +0000 Subject: [PATCH] add the 5 minute difference back and clean --- schedules.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/schedules.js b/schedules.js index 79e86ea8..a1cc6f68 100644 --- a/schedules.js +++ b/schedules.js @@ -17,17 +17,12 @@ async function deleteCaptchas() { const filePath = `${uploadDirectory}captcha/${file}`; const stats = await stat(filePath); const now = Date.now(); - const expiry = new Date(stats.ctime).getTime()// + msTime.minute*5; + const expiry = new Date(stats.ctime).getTime() + msTime.minute*5; if (now > expiry) { await remove(filePath); console.log(`Deleted expired captcha ${filePath}`) } } catch (e) { - /* - catching here to still get the error, but it wont reject the promise - returned by deleteCaptchas, since this is anon async function in the - foreach loop. this way we dont stop deleting captchas if only one fails - */ console.error(e); } }); @@ -41,15 +36,13 @@ async function deleteCaptchas() { console.log('Starting schedules'); -buildHomepage() -deleteCaptchas(); setInterval(async () => { try { await buildHomepage(); } catch (e) { console.error(e); } - }, msTime.hour); //hourly rebuild homepage for posts/day + }, msTime.minute*5); //rebuild homepage for pph updates setInterval(async () => { try {