fork worker processes under bun when the coordinator runs on bun
Signed-off-by: dawn <90008@klbr.net>
188 unmodified linesExpand all18919019119219319319419519619719819920020120220320420520620720820921021120220320420520621221321421521621721821922060 unmodified lines188 unmodified linesExpand all}
async function runWorkerLoop(children, queue, takePlan, activeFamilies, familyOf, { hookPath, out, budget }, onRepoDone) { const maxRepos = Math.max(1, Number(opts["worker-max-repos"]) || 12); const maxRssMb = Math.max(128, Number(opts["worker-max-rss-mb"]) || 650); const maxRssMb = Math.max(128, Number(opts["worker-max-rss-mb"]) || (process.versions.bun ? 360 : 650)); let lastFamily = null; while (queue.length > 0) { const hl = Number(opts.highlighters) > 0 && queue.every((p) => p.weight <= 12) ? "1" : opts.highlighters; const args = [hookPath, "--out", out, "--server", opts.server, "--jobs", opts.jobs, "--highlighters", hl]; if (opts.read) args.push("--read", opts.read); const child = fork(new URL("./worker.mjs", import.meta.url).pathname, args, { execPath: process.execPath, stdio: ["ignore", "inherit", "inherit", "ipc"], env: process.versions.bun ? { ...process.env, BUN_JSC_forceMiniVMMode: process.env.BUN_JSC_forceMiniVMMode ?? "1", BUN_JSC_useWasmFastMemory: process.env.BUN_JSC_useWasmFastMemory ?? "0" } : process.env, // SVFE_PAGES_PROFILE=<dir> writes a cpu profile per worker there execArgv: process.versions.bun ? ["--bun", "--smol"] execArgv: [ "--max-old-space-size=128", "--max-semi-space-size=4", ...(process.env.SVFE_PAGES_PROFILE ? ["--cpu-prof", "--cpu-prof-dir", process.env.SVFE_PAGES_PROFILE] : []) ] : [ "--max-old-space-size=128", "--max-semi-space-size=4", ...(process.env.SVFE_PAGES_PROFILE ? ["--cpu-prof", "--cpu-prof-dir", process.env.SVFE_PAGES_PROFILE] : []) ] }); children.add(child); await new Promise((resolve) => { let current = null;60 unmodified lines