Update center.js

优化代码
This commit is contained in:
huangsijun17 2019-12-10 14:01:34 +08:00 committed by GitHub
parent 829ccd703d
commit 5d95cfccc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,12 +95,12 @@ setInterval(function () {
system: mversion.system
}
let useMemBai = ((os.freemem() / 1024) / (os.totalmem() / 1024) * 100).toFixed(0);
let useMemBai = (os.freemem() / os.totalmem() * 100).toFixed(0);
//压入记录器
MCSERVER.logCenter.pushLogData('CPU', tools.getMineTime(), parseInt(cacheCPU));
MCSERVER.logCenter.pushLogData('RAM', tools.getMineTime(), 100 - useMemBai);
setTimeout(() => counter.save(), 0); //让其异步去保存
setTimeout(() => counter.save(), 0); //让其异步去保存
}, MCSERVER.localProperty.data_center_times);
@ -108,4 +108,4 @@ setInterval(function () {
WebSocketObserver().listener('center/show', (data) => {
if (!permssion.isMaster(data.WsSession)) return;
response.wsSend(data.ws, 'center/show', cacheSystemInfo);
});
});