1
0
Fork 0
mirror of synced 2024-08-17 02:51:55 +12:00

Attempt to fix tests.

This commit is contained in:
Sam Rose 2024-01-24 15:56:17 +00:00
parent f0cecb6e15
commit 1c3069178f
No known key found for this signature in database

View file

@ -74,16 +74,6 @@ export function init() {
throw new Error(`No imports allowed. Required: ${specifier}`)
})
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
if (perRequestLimit) {
const cpuMs = Number(jsIsolate.cpuTime) / 1e6
if (cpuMs > perRequestLimit) {
throw new Error(
`CPU time limit exceeded (${cpuMs}ms > ${perRequestLimit}ms)`
)
}
}
for (const [key, value] of Object.entries(ctx)) {
if (key === "helpers") {
// Can't copy the native helpers into the isolate. We just ignore them as they are handled properly from the helpersSource
@ -97,6 +87,16 @@ export function init() {
let { jsIsolate, jsContext, helpersModule } = bbCtx.isolateRefs!
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
if (perRequestLimit) {
const cpuMs = Number(jsIsolate.cpuTime) / 1e6
if (cpuMs > perRequestLimit) {
throw new Error(
`CPU time limit exceeded (${cpuMs}ms > ${perRequestLimit}ms)`
)
}
}
const script = jsIsolate.compileModuleSync(
`import helpers from "compiled_module";${js};cb(run());`,
{}