fix timeout cycle; fix log-output date
parent
20ae2a33e9
commit
3497fe5ecd
|
|
@ -74,11 +74,15 @@ layout.update();
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
var getChartTimeout;
|
var updateTimeout;
|
||||||
function getChart(period) {
|
function getChart(period) {
|
||||||
//
|
//
|
||||||
const date = new Date().toDateString();
|
const date = new Date();
|
||||||
logFile.write("Called:" + date);
|
const dateString = date.toDateString();
|
||||||
|
logFile.write("Called:" + dateString);
|
||||||
|
|
||||||
|
// Clear any existing timeout
|
||||||
|
if (updateTimeout) clearTimeout(updateTimeout);
|
||||||
//
|
//
|
||||||
timePeriod = period;
|
timePeriod = period;
|
||||||
currLoadMsg = `Load... ${period}`;
|
currLoadMsg = `Load... ${period}`;
|
||||||
|
|
@ -105,13 +109,11 @@ function getChart(period) {
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
// logFile.write("API Error: " + JSON.stringify(err));
|
// logFile.write("API Error: " + JSON.stringify(err));
|
||||||
tknChrtData = [1,2,3,4,5,6,7,8,9,8,7,6,5,4,];
|
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 (getChartTimeout) clearTimeout(getChartTimeout);
|
|
||||||
getChartTimeout = setTimeout(function() {
|
|
||||||
getChartTimeout = undefined;
|
|
||||||
getChart(period);
|
|
||||||
}, 30000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ "id": "coin_info",
|
{ "id": "coin_info",
|
||||||
"name": "Crypto-Coins Info",
|
"name": "Crypto-Coins Info",
|
||||||
"shortName":"Coins Info",
|
"shortName":"Coins Info",
|
||||||
"version": "0.06.49",
|
"version": "0.06.50",
|
||||||
"description": "Crypto-Coins Infos with the help of the Binance API",
|
"description": "Crypto-Coins Infos with the help of the Binance API",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"tags": "clkinfo",
|
"tags": "clkinfo",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue