currentLoad() workarround for empty os.cpus info

This commit is contained in:
Sebastian Hildebrandt
2020-04-29 11:32:28 +02:00
parent 3fe9e0a46f
commit fe9859ecc3
6 changed files with 14 additions and 6 deletions
+1 -1
View File
@@ -1142,7 +1142,7 @@ function getLoad() {
let totalIrq = 0;
let totalIdle = 0;
let cores = [];
_corecount = (cpus && cpus.length) ? cpus.length : 1;
_corecount = (cpus && cpus.length) ? cpus.length : 0;
for (let i = 0; i < _corecount; i++) {
const cpu = cpus[i].times;
+1 -1
View File
@@ -763,7 +763,7 @@ function networkInterfaces(callback) {
}
mac = details.mac;
// fallback due to https://github.com/nodejs/node/issues/13581 (node 8.1 - node 8.2)
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin)) {
if (mac.indexOf('00:00:0') > -1 && (_linux || _darwin) && parseInt(process.versions.node.split('.'), 10) === 8) {
if (Object.keys(_mac).length === 0) {
_mac = getMacAddresses();
}