Skip to content

Commit 97ec444

Browse files
ihabadhamclaude
andcommitted
Fold CI workers cap into parseIntegerEnv default
The post-hoc `if (process.env.CI && env == null) config.workersCount = 2` block mutated an already-constructed config and used a narrower definition of "unset" (`== null`) than parseIntegerEnv's own check (treats "" as unset too). Folding the CI default into the second argument of parseIntegerEnv: workersCount: parseIntegerEnv('RENDERER_WORKERS_COUNT', process.env.CI ? 2 : 3, { min: 0 }) keeps the same behaviour for explicit values, uses one definition of "unset" consistently, and drops the mutation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0eb94af commit 97ec444

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

renderer/node-renderer.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,14 @@ const config = {
3333
password: rendererPassword,
3434
port: parseIntegerEnv('RENDERER_PORT', 3800, { min: 1, max: 65535 }),
3535
supportModules: true,
36-
workersCount: parseIntegerEnv('RENDERER_WORKERS_COUNT', 3, { min: 0 }),
36+
// CI hosts report more CPUs than allocated to the container; default to
37+
// 2 workers on CI to avoid oversubscribing memory. Explicit
38+
// RENDERER_WORKERS_COUNT still wins on either path.
39+
workersCount: parseIntegerEnv('RENDERER_WORKERS_COUNT', process.env.CI ? 2 : 3, { min: 0 }),
3740
// Expose globals the VM sandbox doesn't auto-provide but that downstream
3841
// deps rely on during SSR. Without URL, react-router-dom's NavLink throws
3942
// `ReferenceError: URL is not defined` via encodeLocation.
4043
additionalContext: { URL, AbortController },
4144
};
4245

43-
// CI hosts report more CPUs than allocated to the container; cap workers to
44-
// avoid oversubscribing memory.
45-
if (process.env.CI && process.env.RENDERER_WORKERS_COUNT == null) {
46-
config.workersCount = 2;
47-
}
48-
4946
reactOnRailsProNodeRenderer(config);

0 commit comments

Comments
 (0)