Merge remote-tracking branch 'origin/master' into feature/multistep-form-block

This commit is contained in:
Dean 2024-01-04 11:24:49 +00:00
commit 443ca97152
2 changed files with 5 additions and 2 deletions

View File

@ -50,7 +50,7 @@ export class ExecutionTimeTracker {
return this.totalTimeMs return this.totalTimeMs
} }
private checkLimit() { checkLimit() {
if (this.totalTimeMs > this.limitMs) { if (this.totalTimeMs > this.limitMs) {
throw new ExecutionTimeoutError( throw new ExecutionTimeoutError(
`Execution time limit of ${this.limitMs}ms exceeded: ${this.totalTimeMs}ms` `Execution time limit of ${this.limitMs}ms exceeded: ${this.totalTimeMs}ms`

View File

@ -18,13 +18,16 @@ export function init() {
bbCtx.jsExecutionTracker = bbCtx.jsExecutionTracker =
timers.ExecutionTimeTracker.withLimit(perRequestLimit) timers.ExecutionTimeTracker.withLimit(perRequestLimit)
} }
track = bbCtx.jsExecutionTracker.track.bind(bbCtx.jsExecutionTracker)
span?.addTags({ span?.addTags({
js: { js: {
limitMS: bbCtx.jsExecutionTracker.limitMs, limitMS: bbCtx.jsExecutionTracker.limitMs,
elapsedMS: bbCtx.jsExecutionTracker.elapsedMS, 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)
} }
} }