fix(runtime): bound build memory and parallelism

This commit is contained in:
2026-08-04 16:18:45 +00:00
parent cf0d18f017
commit 41214b03df
5 changed files with 47 additions and 2 deletions
+11
View File
@@ -19,6 +19,17 @@ export const validateComposeModel = (model, mode) => {
if (!positive(runtime.cpus)) errors.push('runtime CPU limit must be positive');
if (!positive(runtime.pids_limit)) errors.push('runtime PID limit must be positive');
const nodeOptions = runtime.environment?.NODE_OPTIONS ?? '';
const heapMatch = /(?:^|\s)--max-old-space-size=(\d+)(?:\s|$)/.exec(nodeOptions);
const heapMiB = Number(heapMatch?.[1] ?? 0);
if (!heapMatch || heapMiB < 512 || heapMiB > 2048) {
errors.push('runtime Node heap limit must be between 512 and 2048 MiB');
}
const rayonThreads = Number(runtime.environment?.RAYON_NUM_THREADS ?? 0);
if (!Number.isInteger(rayonThreads) || rayonThreads < 1 || rayonThreads > 4) {
errors.push('runtime Rayon thread count must be between 1 and 4');
}
if (mode === 'development') {
if (runtime.environment?.RUNTIME_MODE !== 'development') {
errors.push('development runtime mode must be literal development');