do not cache host info
This commit is contained in:
parent
78ea74b066
commit
5269d17324
3 changed files with 8 additions and 30 deletions
|
@ -103,18 +103,6 @@ function setCurrentPedals(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) {
|
||||
if (pedalId === undefined || control === undefined) {
|
||||
return;
|
||||
|
@ -162,8 +150,5 @@ module.exports = {
|
|||
getCurrentPedals,
|
||||
clearCurrentPedals,
|
||||
setCurrentPedals,
|
||||
getInfo,
|
||||
clearInfo,
|
||||
setInfo,
|
||||
updateControl
|
||||
}
|
|
@ -34,7 +34,6 @@ exports.API_BYPASS_BY_ID = BYPASS + '/' + VARIABLE_ID;
|
|||
exports.API_MIDI = MIDI;
|
||||
exports.API_SYSTEMD = SYSTEMD;
|
||||
|
||||
exports.CACHE_INFO = "info";
|
||||
exports.CACHE_BANKS = "banks";
|
||||
exports.CACHE_PEDALBOARDS = "pedalboards";
|
||||
exports.CACHE_PEDALBOARD_DEFAULT = "pedalboard_default";
|
||||
|
|
22
libs/info.js
22
libs/info.js
|
@ -52,20 +52,16 @@ function getMemoryInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
function getTemperature() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
commands.execute("vcgencmd", ["measure_temp"])
|
||||
.then(resolve)
|
||||
.catch(reject);
|
||||
});
|
||||
async function getTemperature() {
|
||||
try {
|
||||
return commands.execute("vcgencmd", ["measure_temp"]);
|
||||
} catch (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
}
|
||||
|
||||
function getHostInfo() {
|
||||
var info = cache.getInfo();
|
||||
if (info != undefined) {
|
||||
return info;
|
||||
}
|
||||
info = {
|
||||
return {
|
||||
hostname: getHostname(),
|
||||
uptime: getUptime(),
|
||||
load: getLoadAverage(),
|
||||
|
@ -76,9 +72,7 @@ function getHostInfo() {
|
|||
kernel: getKernelVersion(),
|
||||
cpu: getCpuInfo(),
|
||||
memory: getMemoryInfo(),
|
||||
}
|
||||
cache.setInfo(info);
|
||||
return info;
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in a new issue