From 258182c5291067210a32b946aca932f394478a10 Mon Sep 17 00:00:00 2001 From: Ambratolm Date: Sat, 5 Mar 2022 03:23:51 +0000 Subject: [PATCH] Minor changes for more crash-proofing --- @reddit-art-poster-consumer.js | 4 +++- bots/reddit-art-poster/tasklist.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/@reddit-art-poster-consumer.js b/@reddit-art-poster-consumer.js index 42ee541..23d7be5 100644 --- a/@reddit-art-poster-consumer.js +++ b/@reddit-art-poster-consumer.js @@ -24,7 +24,9 @@ module.exports = { this.line(); // Fetch schedule references - const fetchedSchedRefsCount = await redditArtPoster.fetchSchedRefs(); + const fetchedSchedRefsCount = await redditArtPoster.fetchSchedRefs({ + force: true, + }); this.line(); this.log( `${fetchedSchedRefsCount} / ${redditArtPoster.count} schedule references fetched.` diff --git a/bots/reddit-art-poster/tasklist.js b/bots/reddit-art-poster/tasklist.js index c8a5520..9e77678 100644 --- a/bots/reddit-art-poster/tasklist.js +++ b/bots/reddit-art-poster/tasklist.js @@ -49,11 +49,11 @@ module.exports = class Tasklist { for (const [i, task] of this._tasks.entries()) { if (await task.execute()) { count++; + if (save) await this.save(); await sleep(random(1000, 5000)); } if (i < this._tasks.length - 1) console.line(); } - if (save) await this.save(); return count; } @@ -63,10 +63,10 @@ module.exports = class Tasklist { for (const task of this._tasks) { if (await task.fetchScheduleReference({ force })) { count++; + if (save) await this.save(); await sleep(random(1000, 5000)); } } - if (save) await this.save(); return count; }