1
0
Fork 0
mirror of synced 2024-07-04 05:50:57 +12:00

Respond to Adri's feedback.

This commit is contained in:
Sam Rose 2024-03-07 15:01:38 +00:00
parent ce599e775f
commit 9b91e47220
No known key found for this signature in database

View file

@ -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