enhance(dev): メモリ使用量比較のActionsでGCしてから取得する

Resolve #16961
This commit is contained in:
syuilo 2026-01-14 16:12:44 +09:00
parent bd81a6c8ad
commit ec683f04d1
3 changed files with 9 additions and 2 deletions

View File

@ -25,11 +25,13 @@ async function measureMemory() {
const startTime = Date.now(); const startTime = Date.now();
// Start the Misskey backend server using fork to enable IPC // Start the Misskey backend server using fork to enable IPC
const serverProcess = fork(join(__dirname, '../built/boot/entry.js'), [], { const serverProcess = fork(join(__dirname, '../built/boot/entry.js'), ['expose-gc'], {
cwd: join(__dirname, '..'), cwd: join(__dirname, '..'),
env: { env: {
...process.env, ...process.env,
NODE_ENV: 'test', NODE_ENV: 'production',
MK_DISABLE_CLUSTERING: '1',
MK_FORCE_GC: '1',
}, },
stdio: ['pipe', 'pipe', 'pipe', 'ipc'], stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
}); });

View File

@ -86,6 +86,10 @@ if (!envOption.disableClustering) {
ev.mount(); ev.mount();
} }
if (envOption.forceGc && global.gc != null) {
global.gc();
}
readyRef.value = true; readyRef.value = true;
// ユニットテスト時にMisskeyが子プロセスで起動された時のため // ユニットテスト時にMisskeyが子プロセスで起動された時のため

View File

@ -11,6 +11,7 @@ const envOption = {
verbose: false, verbose: false,
withLogTime: false, withLogTime: false,
quiet: false, quiet: false,
forceGc: false,
}; };
for (const key of Object.keys(envOption) as (keyof typeof envOption)[]) { for (const key of Object.keys(envOption) as (keyof typeof envOption)[]) {