mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
feat: N8N_RUNNERS_MAX_OLD_SPACE_SIZE configuration (no-changelog) (#11419)
This commit is contained in:
@@ -38,6 +38,12 @@ export class TaskRunnerProcess {
|
||||
|
||||
private isShuttingDown = false;
|
||||
|
||||
private readonly passthroughEnvVars = [
|
||||
'PATH',
|
||||
'NODE_FUNCTION_ALLOW_BUILTIN',
|
||||
'NODE_FUNCTION_ALLOW_EXTERNAL',
|
||||
] as const;
|
||||
|
||||
constructor(
|
||||
private readonly runnerConfig: TaskRunnersConfig,
|
||||
private readonly authService: TaskRunnerAuthService,
|
||||
@@ -68,26 +74,14 @@ export class TaskRunnerProcess {
|
||||
const startScript = require.resolve('@n8n/task-runner');
|
||||
|
||||
return spawn('node', [startScript], {
|
||||
env: {
|
||||
PATH: process.env.PATH,
|
||||
N8N_RUNNERS_GRANT_TOKEN: grantToken,
|
||||
N8N_RUNNERS_N8N_URI: n8nUri,
|
||||
N8N_RUNNERS_MAX_PAYLOAD: this.runnerConfig.maxPayload.toString(),
|
||||
NODE_FUNCTION_ALLOW_BUILTIN: process.env.NODE_FUNCTION_ALLOW_BUILTIN,
|
||||
NODE_FUNCTION_ALLOW_EXTERNAL: process.env.NODE_FUNCTION_ALLOW_EXTERNAL,
|
||||
},
|
||||
env: this.getProcessEnvVars(grantToken, n8nUri),
|
||||
});
|
||||
}
|
||||
|
||||
startLauncher(grantToken: string, n8nUri: string) {
|
||||
return spawn(this.runnerConfig.launcherPath, ['launch', this.runnerConfig.launcherRunner], {
|
||||
env: {
|
||||
PATH: process.env.PATH,
|
||||
N8N_RUNNERS_GRANT_TOKEN: grantToken,
|
||||
N8N_RUNNERS_N8N_URI: n8nUri,
|
||||
N8N_RUNNERS_MAX_PAYLOAD: this.runnerConfig.maxPayload.toString(),
|
||||
NODE_FUNCTION_ALLOW_BUILTIN: process.env.NODE_FUNCTION_ALLOW_BUILTIN,
|
||||
NODE_FUNCTION_ALLOW_EXTERNAL: process.env.NODE_FUNCTION_ALLOW_EXTERNAL,
|
||||
...this.getProcessEnvVars(grantToken, n8nUri),
|
||||
// For debug logging if enabled
|
||||
RUST_LOG: process.env.RUST_LOG,
|
||||
},
|
||||
@@ -155,4 +149,29 @@ export class TaskRunnerProcess {
|
||||
setImmediate(async () => await this.start());
|
||||
}
|
||||
}
|
||||
|
||||
private getProcessEnvVars(grantToken: string, n8nUri: string) {
|
||||
const envVars: Record<string, string> = {
|
||||
N8N_RUNNERS_GRANT_TOKEN: grantToken,
|
||||
N8N_RUNNERS_N8N_URI: n8nUri,
|
||||
N8N_RUNNERS_MAX_PAYLOAD: this.runnerConfig.maxPayload.toString(),
|
||||
...this.getPassthroughEnvVars(),
|
||||
};
|
||||
|
||||
if (this.runnerConfig.maxOldSpaceSize) {
|
||||
envVars.NODE_OPTIONS = `--max-old-space-size=${this.runnerConfig.maxOldSpaceSize}`;
|
||||
}
|
||||
|
||||
return envVars;
|
||||
}
|
||||
|
||||
private getPassthroughEnvVars() {
|
||||
return this.passthroughEnvVars.reduce<Record<string, string>>((env, key) => {
|
||||
if (process.env[key]) {
|
||||
env[key] = process.env[key];
|
||||
}
|
||||
|
||||
return env;
|
||||
}, {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user