Memory limit via env
This commit is contained in:
parent
9a45017532
commit
0b0b6ddb13
|
@ -2,6 +2,7 @@ import ivm from "isolated-vm"
|
||||||
|
|
||||||
import bson from "bson"
|
import bson from "bson"
|
||||||
import { BundleType, loadBundle } from "../jsRunner/bundles"
|
import { BundleType, loadBundle } from "../jsRunner/bundles"
|
||||||
|
import env from "../environment"
|
||||||
|
|
||||||
const JS_TIMEOUT_MS = 1000
|
const JS_TIMEOUT_MS = 1000
|
||||||
|
|
||||||
|
@ -9,7 +10,7 @@ class ScriptRunner {
|
||||||
vm: IsolatedVM
|
vm: IsolatedVM
|
||||||
|
|
||||||
constructor(script: string, context: any) {
|
constructor(script: string, context: any) {
|
||||||
this.vm = new IsolatedVM({ memoryLimit: 64 })
|
this.vm = new IsolatedVM({ memoryLimit: env.JS_RUNNER_MEMORY_LIMIT })
|
||||||
this.vm.context = {
|
this.vm.context = {
|
||||||
...context,
|
...context,
|
||||||
data: bson.BSON.serialize({ data: context.data }),
|
data: bson.BSON.serialize({ data: context.data }),
|
||||||
|
|
Loading…
Reference in New Issue