1
0
Fork 0
mirror of synced 2024-10-06 04:54:52 +13:00

Memory limit via env

This commit is contained in:
Adria Navarro 2024-02-06 15:13:34 +01:00
parent 9a45017532
commit 0b0b6ddb13

View file

@ -2,6 +2,7 @@ import ivm from "isolated-vm"
import bson from "bson"
import { BundleType, loadBundle } from "../jsRunner/bundles"
import env from "../environment"
const JS_TIMEOUT_MS = 1000
@ -9,7 +10,7 @@ class ScriptRunner {
vm: IsolatedVM
constructor(script: string, context: any) {
this.vm = new IsolatedVM({ memoryLimit: 64 })
this.vm = new IsolatedVM({ memoryLimit: env.JS_RUNNER_MEMORY_LIMIT })
this.vm.context = {
...context,
data: bson.BSON.serialize({ data: context.data }),