Fix defaulting values

This commit is contained in:
Adria Navarro 2024-02-19 21:04:33 +01:00
parent 601c02a4ac
commit 43a2842833
1 changed files with 4 additions and 5 deletions

View File

@ -38,10 +38,9 @@ export class IsolatedVM implements VM {
invocationTimeout?: number
isolateAccumulatedTimeout?: number
} = {}) {
memoryLimit = memoryLimit || environment.JS_RUNNER_MEMORY_LIMIT
invocationTimeout = memoryLimit || 1000
this.isolate = new ivm.Isolate({ memoryLimit })
this.isolate = new ivm.Isolate({
memoryLimit: memoryLimit || environment.JS_RUNNER_MEMORY_LIMIT,
})
this.vm = this.isolate.createContextSync()
this.jail = this.vm.global
this.jail.setSync("global", this.jail.derefInto())
@ -51,7 +50,7 @@ export class IsolatedVM implements VM {
[this.resultKey]: { [this.runResultKey]: "" },
})
this.invocationTimeout = invocationTimeout
this.invocationTimeout = invocationTimeout || 1000
this.isolateAccumulatedTimeout = isolateAccumulatedTimeout
}