diff --git a/apps/coin_info/app.js b/apps/coin_info/app.js index 0af74eae3..b53935762 100644 --- a/apps/coin_info/app.js +++ b/apps/coin_info/app.js @@ -77,10 +77,8 @@ layout.update(); var updateTimeout; function getChart(period) { // - logFile.write("Called:" + Date.toString()); - - // Clear any existing timeout - if (updateTimeout) clearTimeout(updateTimeout); + const date = new Date(); + logFile.write("Called:" + date.toString()); // timePeriod = period; currLoadMsg = `Load... ${period}`; @@ -107,11 +105,13 @@ function getChart(period) { .catch(err => { // logFile.write("API Error: " + JSON.stringify(err)); tknChrtData = [1,2,3,4,5,6,7,8,9,8,7,6,5,4,]; - }) - .finally(() => { - // Schedule next update regardless of success or failure - updateTimeout = setTimeout(getChart, 30000, period); // 5 minutes }); + + if (updateTimeout) clearTimeout(updateTimeout); + updateTimeout = setTimeout(function() { + updateTimeout = undefined; + getChart(period); + }, 30000 - (Date.now() % 30000)); } // diff --git a/apps/coin_info/metadata.json b/apps/coin_info/metadata.json index 3e263b703..04d293aae 100644 --- a/apps/coin_info/metadata.json +++ b/apps/coin_info/metadata.json @@ -1,7 +1,7 @@ { "id": "coin_info", "name": "Crypto-Coins Info", "shortName":"Coins Info", - "version": "0.06.51", + "version": "0.06.52", "description": "Crypto-Coins Infos with the help of the Binance API", "icon": "app.png", "tags": "clkinfo",