Fix check for whether stats are disabled in meta in server machine stats job

This commit is contained in:
yumeko 2024-04-16 15:29:18 +00:00
parent 86f2e32c66
commit bf3c0717b9
1 changed files with 3 additions and 4 deletions

View File

@ -13,16 +13,15 @@ const round = (num: number) => Math.round(num * 10) / 10;
/**
* Report server stats regularly
*/
export default function () {
export default async function () {
const log = [] as any[];
ev.on("requestServerStatsLog", (x) => {
ev.emit(`serverStatsLog:${x.id}`, log.slice(0, x.length || 50));
});
fetchMeta(true).then((meta) => {
if (!meta.enableServerMachineStats) return;
});
const meta = await fetchMeta(true);
if (!meta.enableServerMachineStats) return;
async function tick() {
const cpu = await cpuUsage();