1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 08:45:44 +02:00

perf(backend): lazy load systeminformation

systeminformationを必要とする機能を有効にしていないサーバーで無駄に読み込まれることが無いように
This commit is contained in:
syuilo
2025-12-18 20:05:20 +09:00
parent dba44daf9c
commit baeed4bc80
5 changed files with 10 additions and 10 deletions

View File

@@ -4,15 +4,11 @@
*/
import * as os from 'node:os';
import sysUtils from 'systeminformation';
import type Logger from '@/logger.js';
export async function showMachineInfo(parentLogger: Logger) {
const logger = parentLogger.createSubLogger('machine');
logger.debug(`Hostname: ${os.hostname()}`);
logger.debug(`Platform: ${process.platform} Arch: ${process.arch}`);
const mem = await sysUtils.mem();
const totalmem = (mem.total / 1024 / 1024 / 1024).toFixed(1);
const availmem = (mem.available / 1024 / 1024 / 1024).toFixed(1);
logger.debug(`CPU: ${os.cpus().length} core MEM: ${totalmem}GB (available: ${availmem}GB)`);
logger.debug(`CPU: ${os.cpus().length} core MEM: ${(os.totalmem() / 1024 / 1024 / 1024).toFixed(1)}GB (available: ${(os.freemem() / 1024 / 1024 / 1024).toFixed(1)}GB)`);
}