Merge branch 'master' into feature/postgresql-multiple-schema
This commit is contained in:
commit
efe8e7f990
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.14.3",
|
"version": "2.14.4",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"packages/*",
|
||||||
|
|
|
@ -12,36 +12,51 @@ export function init() {
|
||||||
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
|
const perRequestLimit = env.JS_PER_REQUEST_TIME_LIMIT_MS
|
||||||
let track: TrackerFn = f => f()
|
let track: TrackerFn = f => f()
|
||||||
if (perRequestLimit) {
|
if (perRequestLimit) {
|
||||||
const bbCtx = context.getCurrentContext()
|
tracer.trace<any>("runJS.setupTracker", {}, span => {
|
||||||
if (bbCtx) {
|
const bbCtx = context.getCurrentContext()
|
||||||
if (!bbCtx.jsExecutionTracker) {
|
if (bbCtx) {
|
||||||
bbCtx.jsExecutionTracker =
|
if (!bbCtx.jsExecutionTracker) {
|
||||||
timers.ExecutionTimeTracker.withLimit(perRequestLimit)
|
span?.addTags({
|
||||||
|
createdExecutionTracker: true,
|
||||||
|
})
|
||||||
|
bbCtx.jsExecutionTracker =
|
||||||
|
timers.ExecutionTimeTracker.withLimit(perRequestLimit)
|
||||||
|
}
|
||||||
|
span?.addTags({
|
||||||
|
js: {
|
||||||
|
limitMS: bbCtx.jsExecutionTracker.limitMs,
|
||||||
|
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
// We call checkLimit() here to prevent paying the cost of creating
|
||||||
|
// a new VM context below when we don't need to.
|
||||||
|
bbCtx.jsExecutionTracker.checkLimit()
|
||||||
|
track = bbCtx.jsExecutionTracker.track.bind(
|
||||||
|
bbCtx.jsExecutionTracker
|
||||||
|
)
|
||||||
}
|
}
|
||||||
span?.addTags({
|
})
|
||||||
js: {
|
|
||||||
limitMS: bbCtx.jsExecutionTracker.limitMs,
|
|
||||||
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
// We call checkLimit() here to prevent paying the cost of creating
|
|
||||||
// a new VM context below when we don't need to.
|
|
||||||
bbCtx.jsExecutionTracker.checkLimit()
|
|
||||||
track = bbCtx.jsExecutionTracker.track.bind(bbCtx.jsExecutionTracker)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx = {
|
ctx = tracer.trace("runJS.ctxClone", {}, span => {
|
||||||
...ctx,
|
return {
|
||||||
alert: undefined,
|
...ctx,
|
||||||
setInterval: undefined,
|
alert: undefined,
|
||||||
setTimeout: undefined,
|
setInterval: undefined,
|
||||||
}
|
setTimeout: undefined,
|
||||||
vm.createContext(ctx)
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
tracer.trace("runJS.vm.createContext", {}, span => {
|
||||||
|
vm.createContext(ctx)
|
||||||
|
})
|
||||||
|
|
||||||
return track(() =>
|
return track(() =>
|
||||||
vm.runInNewContext(js, ctx, {
|
tracer.trace("runJS.vm.runInNewContext", {}, span =>
|
||||||
timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
|
vm.runInNewContext(js, ctx, {
|
||||||
})
|
timeout: env.JS_PER_EXECUTION_TIME_LIMIT_MS,
|
||||||
|
})
|
||||||
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue