@budibase/backend-core 2.17.0 → 2.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -0
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +5 -5
- package/dist/src/context/types.d.ts +2 -6
- package/dist/src/timers/timers.d.ts +12 -0
- package/dist/src/timers/timers.js +38 -1
- package/dist/src/timers/timers.js.map +1 -1
- package/package.json +5 -5
- package/src/context/types.ts +2 -6
- package/src/timers/timers.ts +38 -0
package/dist/index.js
CHANGED
|
@@ -4662,6 +4662,8 @@ function logWarn(message, e) {
|
|
|
4662
4662
|
// src/timers/index.ts
|
|
4663
4663
|
var timers_exports = {};
|
|
4664
4664
|
__export(timers_exports, {
|
|
4665
|
+
ExecutionTimeTracker: () => ExecutionTimeTracker,
|
|
4666
|
+
ExecutionTimeoutError: () => ExecutionTimeoutError,
|
|
4665
4667
|
cleanup: () => cleanup,
|
|
4666
4668
|
clear: () => clear,
|
|
4667
4669
|
set: () => set
|
|
@@ -4687,6 +4689,42 @@ function cleanup() {
|
|
|
4687
4689
|
}
|
|
4688
4690
|
intervals = [];
|
|
4689
4691
|
}
|
|
4692
|
+
var ExecutionTimeoutError = class extends Error {
|
|
4693
|
+
constructor() {
|
|
4694
|
+
super(...arguments);
|
|
4695
|
+
this.name = "ExecutionTimeoutError";
|
|
4696
|
+
}
|
|
4697
|
+
};
|
|
4698
|
+
var ExecutionTimeTracker = class _ExecutionTimeTracker {
|
|
4699
|
+
constructor(limitMs) {
|
|
4700
|
+
this.limitMs = limitMs;
|
|
4701
|
+
this.totalTimeMs = 0;
|
|
4702
|
+
}
|
|
4703
|
+
static withLimit(limitMs) {
|
|
4704
|
+
return new _ExecutionTimeTracker(limitMs);
|
|
4705
|
+
}
|
|
4706
|
+
track(f) {
|
|
4707
|
+
this.checkLimit();
|
|
4708
|
+
const start2 = process.hrtime.bigint();
|
|
4709
|
+
try {
|
|
4710
|
+
return f();
|
|
4711
|
+
} finally {
|
|
4712
|
+
const end2 = process.hrtime.bigint();
|
|
4713
|
+
this.totalTimeMs += Number(end2 - start2) / 1e6;
|
|
4714
|
+
this.checkLimit();
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
get elapsedMS() {
|
|
4718
|
+
return this.totalTimeMs;
|
|
4719
|
+
}
|
|
4720
|
+
checkLimit() {
|
|
4721
|
+
if (this.totalTimeMs > this.limitMs) {
|
|
4722
|
+
throw new ExecutionTimeoutError(
|
|
4723
|
+
`Execution time limit of ${this.limitMs}ms exceeded: ${this.totalTimeMs}ms`
|
|
4724
|
+
);
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4690
4728
|
|
|
4691
4729
|
// src/redis/redis.ts
|
|
4692
4730
|
var MockRedis;
|