From f3236f26d5b9a21c90a881a58eba76846593c55d Mon Sep 17 00:00:00 2001 From: Jonathan Barrow Date: Thu, 25 Nov 2021 13:02:31 -0500 Subject: [PATCH] Changed trello available check --- src/trello.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/trello.js b/src/trello.js index eee6018..50c2827 100644 --- a/src/trello.js +++ b/src/trello.js @@ -6,15 +6,20 @@ const trello = new Trello(config.trello.api_key, config.trello.api_token); let cache; async function getTrelloCache() { + const available = await trelloAPIAvailable(); + if (!available) { + return { + update_time: Date.now(), + sections: [] + }; + } + if (!cache) { cache = await updateTrelloCache(); } if (cache.update_time < Date.now() - (1000 * 60 * 60)) { - const available = await trelloAPIAvailable(); - if (available) { - cache = await updateTrelloCache(); - } + cache = await updateTrelloCache(); } return cache;