mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-24 19:05:29 +00:00
⚡ use better-sqlite3 as default db
This commit is contained in:
+18
-17
@@ -15,22 +15,23 @@ export function initStats() {
|
||||
);
|
||||
}
|
||||
|
||||
setInterval(async () => {
|
||||
const [cpuUsed, memory, network] = await Promise.all([
|
||||
osu.cpu.usage(),
|
||||
osu.mem.info(),
|
||||
osu.netstat.inOut(),
|
||||
]);
|
||||
var networkUsage = "";
|
||||
if (typeof network === "object") {
|
||||
networkUsage = `| [Network]: in ${network.total.inputMb}mb | out ${network.total.outputMb}mb`;
|
||||
}
|
||||
// TODO: node-os-utils might have a memory leak, more investigation needed
|
||||
// TODO: doesn't work if spawned with multiple threads
|
||||
// setInterval(async () => {
|
||||
// const [cpuUsed, memory, network] = await Promise.all([
|
||||
// osu.cpu.usage(),
|
||||
// osu.mem.info(),
|
||||
// osu.netstat.inOut(),
|
||||
// ]);
|
||||
// var networkUsage = "";
|
||||
// if (typeof network === "object") {
|
||||
// networkUsage = `| [Network]: in ${network.total.inputMb}mb | out ${network.total.outputMb}mb`;
|
||||
// }
|
||||
|
||||
console.log(
|
||||
`[CPU] ${cpuUsed.toPrecision(3)}% | [Memory] ${Math.round(
|
||||
process.memoryUsage().rss / 1024 / 1024
|
||||
)}mb/${memory.totalMemMb.toFixed(0)}mb ${networkUsage}`
|
||||
);
|
||||
// TODO: node-os-utils might have a memory leak, more investigation needed
|
||||
}, 1000 * 60 * 5);
|
||||
// console.log(
|
||||
// `[CPU] ${cpuUsed.toPrecision(3)}% | [Memory] ${Math.round(
|
||||
// process.memoryUsage().rss / 1024 / 1024
|
||||
// )}mb/${memory.totalMemMb.toFixed(0)}mb ${networkUsage}`
|
||||
// );
|
||||
// }, 1000 * 60 * 5);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user