do not cache host info

This commit is contained in:
Daniel Sommer 2022-03-25 12:34:24 +01:00
parent 78ea74b066
commit 5269d17324
3 changed files with 8 additions and 30 deletions

View file

@ -103,18 +103,6 @@ function setCurrentPedals(value) {
setValue(constants.CACHE_PEDALS, value); setValue(constants.CACHE_PEDALS, value);
} }
function getInfo() {
return getValue(constants.CACHE_INFO);
}
function clearInfo() {
resetValue(constants.CACHE_INFO);
}
function setInfo(value) {
setValue(constants.CACHE_INFO, value);
}
function updateControl(pedalId, control) { function updateControl(pedalId, control) {
if (pedalId === undefined || control === undefined) { if (pedalId === undefined || control === undefined) {
return; return;
@ -162,8 +150,5 @@ module.exports = {
getCurrentPedals, getCurrentPedals,
clearCurrentPedals, clearCurrentPedals,
setCurrentPedals, setCurrentPedals,
getInfo,
clearInfo,
setInfo,
updateControl updateControl
} }

View file

@ -34,7 +34,6 @@ exports.API_BYPASS_BY_ID = BYPASS + '/' + VARIABLE_ID;
exports.API_MIDI = MIDI; exports.API_MIDI = MIDI;
exports.API_SYSTEMD = SYSTEMD; exports.API_SYSTEMD = SYSTEMD;
exports.CACHE_INFO = "info";
exports.CACHE_BANKS = "banks"; exports.CACHE_BANKS = "banks";
exports.CACHE_PEDALBOARDS = "pedalboards"; exports.CACHE_PEDALBOARDS = "pedalboards";
exports.CACHE_PEDALBOARD_DEFAULT = "pedalboard_default"; exports.CACHE_PEDALBOARD_DEFAULT = "pedalboard_default";

View file

@ -52,20 +52,16 @@ function getMemoryInfo() {
} }
} }
function getTemperature() { async function getTemperature() {
return new Promise(function (resolve, reject) { try {
commands.execute("vcgencmd", ["measure_temp"]) return commands.execute("vcgencmd", ["measure_temp"]);
.then(resolve) } catch (err) {
.catch(reject); throw new Error(err);
}); }
} }
function getHostInfo() { function getHostInfo() {
var info = cache.getInfo(); return {
if (info != undefined) {
return info;
}
info = {
hostname: getHostname(), hostname: getHostname(),
uptime: getUptime(), uptime: getUptime(),
load: getLoadAverage(), load: getLoadAverage(),
@ -76,9 +72,7 @@ function getHostInfo() {
kernel: getKernelVersion(), kernel: getKernelVersion(),
cpu: getCpuInfo(), cpu: getCpuInfo(),
memory: getMemoryInfo(), memory: getMemoryInfo(),
} };
cache.setInfo(info);
return info;
} }
module.exports = { module.exports = {