Allow configuring memory limits

This commit is contained in:
Adria Navarro 2024-01-31 16:55:59 +01:00
parent f2aeb56671
commit 805b24975b
2 changed files with 5 additions and 1 deletions

View File

@ -95,6 +95,8 @@ const environment = {
TOP_LEVEL_PATH:
process.env.TOP_LEVEL_PATH || process.env.SERVER_TOP_LEVEL_PATH,
APP_MIGRATION_TIMEOUT: parseIntSafe(process.env.APP_MIGRATION_TIMEOUT),
JS_RUNNER_MEMORY_LIMIT:
parseIntSafe(process.env.JS_RUNNER_MEMORY_LIMIT) || 64,
}
// threading can cause memory issues with node-ts in development

View File

@ -27,7 +27,9 @@ export function init() {
const isolateRefs = bbCtx.isolateRefs
if (!isolateRefs) {
const jsIsolate = new ivm.Isolate({ memoryLimit: 64 })
const jsIsolate = new ivm.Isolate({
memoryLimit: env.JS_RUNNER_MEMORY_LIMIT,
})
const jsContext = jsIsolate.createContextSync()
const injectedRequire = `const require = function(val){