summaryrefslogtreecommitdiff
path: root/src/daemons
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-07-27 18:42:58 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-07-27 18:42:58 +0900
commit3d8b45ecdd2c396c106cfba4ffd00fce975a6da4 (patch)
treea860888b715bae9ad3045af067a93b1b60e5b6c2 /src/daemons
parentMerge branch 'master' of https://github.com/syuilo/misskey (diff)
downloadsharkey-3d8b45ecdd2c396c106cfba4ffd00fce975a6da4.tar.gz
sharkey-3d8b45ecdd2c396c106cfba4ffd00fce975a6da4.tar.bz2
sharkey-3d8b45ecdd2c396c106cfba4ffd00fce975a6da4.zip
Use os-utils
Diffstat (limited to 'src/daemons')
-rw-r--r--src/daemons/server-stats.ts15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/daemons/server-stats.ts b/src/daemons/server-stats.ts
index de70cf40b8..0c0a72f747 100644
--- a/src/daemons/server-stats.ts
+++ b/src/daemons/server-stats.ts
@@ -2,6 +2,7 @@ import * as os from 'os';
import * as sysUtils from 'systeminformation';
import * as diskusage from 'diskusage';
import Xev from 'xev';
+const osUtils = require('os-utils');
const ev = new Xev();
@@ -44,14 +45,12 @@ export default function() {
}
// CPU STAT
-async function cpuUsage() {
- try {
- const data = await sysUtils.currentLoad();
- return Math.floor(data.currentload / 100);
- } catch (error) {
- console.error(error);
- throw error;
- }
+function cpuUsage() {
+ return new Promise((res, rej) => {
+ osUtils.cpuUsage((cpuUsage: number) => {
+ res(cpuUsage);
+ });
+ });
}
// MEMORY(excl buffer + cache) STAT