From 9b91e47220304fc7e17b53ac842b8c2e3e710bd2 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Thu, 7 Mar 2024 15:01:38 +0000 Subject: [PATCH] Respond to Adri's feedback. --- packages/server/src/jsRunner/index.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/server/src/jsRunner/index.ts b/packages/server/src/jsRunner/index.ts index 61821c0d0e..19bf0fa6b5 100644 --- a/packages/server/src/jsRunner/index.ts +++ b/packages/server/src/jsRunner/index.ts @@ -16,16 +16,13 @@ export function init() { try { const bbCtx = context.getCurrentContext() - let vm: VM - if (bbCtx && bbCtx.vm) { - vm = bbCtx.vm - } else { - vm = new IsolatedVM({ + const vm = + bbCtx?.vm || + new IsolatedVM({ memoryLimit: env.JS_RUNNER_MEMORY_LIMIT, invocationTimeout: env.JS_PER_INVOCATION_TIMEOUT_MS, isolateAccumulatedTimeout: env.JS_PER_REQUEST_TIMEOUT_MS, }).withHelpers() - } if (bbCtx && !bbCtx.vm) { bbCtx.vm = vm