@budibase/server 2.6.19-alpha.30 → 2.6.19-alpha.34
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/builder/assets/{index.8469b14c.css → index.a96c516c.css} +1 -1
- package/builder/assets/{index.3dd3d237.js → index.b6e30d5b.js} +3 -3
- package/builder/index.html +2 -2
- package/dist/automation.js +148 -90
- package/dist/automation.js.map +3 -3
- package/dist/index.js +234 -164
- package/dist/index.js.map +3 -3
- package/dist/query.js +27 -13
- package/dist/query.js.map +2 -2
- package/package.json +9 -8
- package/src/automations/logging/index.ts +21 -0
- package/src/environment.ts +1 -0
- package/src/middleware/builder.ts +22 -13
- package/src/threads/automation.ts +49 -28
- package/src/threads/index.ts +9 -3
- package/src/threads/utils.ts +2 -0
- package/src/utilities/fileSystem/app.ts +14 -4
package/dist/query.js
CHANGED
|
@@ -3143,6 +3143,7 @@ var init_logger = __esm({
|
|
|
3143
3143
|
}
|
|
3144
3144
|
const mergingObject = {
|
|
3145
3145
|
err: error,
|
|
3146
|
+
pid: process.pid,
|
|
3146
3147
|
...contextObject
|
|
3147
3148
|
};
|
|
3148
3149
|
if (objects.length) {
|
|
@@ -5571,6 +5572,7 @@ var environment = {
|
|
|
5571
5572
|
ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS,
|
|
5572
5573
|
SELF_HOSTED: process.env.SELF_HOSTED,
|
|
5573
5574
|
HTTP_MB_LIMIT: process.env.HTTP_MB_LIMIT,
|
|
5575
|
+
FORKED_PROCESS_NAME: process.env.FORKED_PROCESS_NAME || "main",
|
|
5574
5576
|
// old
|
|
5575
5577
|
CLIENT_ID: process.env.CLIENT_ID,
|
|
5576
5578
|
_set(key, value) {
|
|
@@ -5896,14 +5898,15 @@ init_src();
|
|
|
5896
5898
|
// ../backend-core/src/redis/redlockImpl.ts
|
|
5897
5899
|
var redlockImpl_exports = {};
|
|
5898
5900
|
__export(redlockImpl_exports, {
|
|
5899
|
-
doWithLock: () => doWithLock
|
|
5901
|
+
doWithLock: () => doWithLock,
|
|
5902
|
+
newRedlock: () => newRedlock
|
|
5900
5903
|
});
|
|
5901
5904
|
var import_redlock = __toESM(require("redlock"));
|
|
5902
5905
|
init_init();
|
|
5903
5906
|
init_src();
|
|
5904
5907
|
init_context2();
|
|
5905
5908
|
init_environment2();
|
|
5906
|
-
|
|
5909
|
+
async function getClient(type, opts) {
|
|
5907
5910
|
if (type === "custom" /* CUSTOM */) {
|
|
5908
5911
|
return newRedlock(opts);
|
|
5909
5912
|
}
|
|
@@ -5914,6 +5917,9 @@ var getClient = async (type, opts) => {
|
|
|
5914
5917
|
case "try_once" /* TRY_ONCE */: {
|
|
5915
5918
|
return newRedlock(OPTIONS.TRY_ONCE);
|
|
5916
5919
|
}
|
|
5920
|
+
case "try_twice" /* TRY_TWICE */: {
|
|
5921
|
+
return newRedlock(OPTIONS.TRY_TWICE);
|
|
5922
|
+
}
|
|
5917
5923
|
case "default" /* DEFAULT */: {
|
|
5918
5924
|
return newRedlock(OPTIONS.DEFAULT);
|
|
5919
5925
|
}
|
|
@@ -5924,12 +5930,15 @@ var getClient = async (type, opts) => {
|
|
|
5924
5930
|
throw new Error(`Could not get redlock client: ${type}`);
|
|
5925
5931
|
}
|
|
5926
5932
|
}
|
|
5927
|
-
}
|
|
5933
|
+
}
|
|
5928
5934
|
var OPTIONS = {
|
|
5929
5935
|
TRY_ONCE: {
|
|
5930
5936
|
// immediately throws an error if the lock is already held
|
|
5931
5937
|
retryCount: 0
|
|
5932
5938
|
},
|
|
5939
|
+
TRY_TWICE: {
|
|
5940
|
+
retryCount: 1
|
|
5941
|
+
},
|
|
5933
5942
|
TEST: {
|
|
5934
5943
|
// higher retry count in unit tests
|
|
5935
5944
|
// due to high contention.
|
|
@@ -5956,21 +5965,25 @@ var OPTIONS = {
|
|
|
5956
5965
|
retryDelay: 500
|
|
5957
5966
|
}
|
|
5958
5967
|
};
|
|
5959
|
-
|
|
5968
|
+
async function newRedlock(opts = {}) {
|
|
5960
5969
|
let options2 = { ...OPTIONS.DEFAULT, ...opts };
|
|
5961
5970
|
const redisWrapper = await getLockClient();
|
|
5962
5971
|
const client3 = redisWrapper.getClient();
|
|
5963
5972
|
return new import_redlock.default([client3], options2);
|
|
5964
|
-
}
|
|
5965
|
-
|
|
5973
|
+
}
|
|
5974
|
+
function getLockName(opts) {
|
|
5975
|
+
const prefix = opts.systemLock ? "system" : getTenantId();
|
|
5976
|
+
let name = `lock:${prefix}_${opts.name}`;
|
|
5977
|
+
if (opts.resource) {
|
|
5978
|
+
name = name + `_${opts.resource}`;
|
|
5979
|
+
}
|
|
5980
|
+
return name;
|
|
5981
|
+
}
|
|
5982
|
+
async function doWithLock(opts, task) {
|
|
5966
5983
|
const redlock = await getClient(opts.type, opts.customOptions);
|
|
5967
5984
|
let lock;
|
|
5968
5985
|
try {
|
|
5969
|
-
const
|
|
5970
|
-
let name = `lock:${prefix}_${opts.name}`;
|
|
5971
|
-
if (opts.resource) {
|
|
5972
|
-
name = name + `_${opts.resource}`;
|
|
5973
|
-
}
|
|
5986
|
+
const name = getLockName(opts);
|
|
5974
5987
|
lock = await redlock.lock(name, opts.ttl);
|
|
5975
5988
|
const result = await task();
|
|
5976
5989
|
return { executed: true, result };
|
|
@@ -5978,7 +5991,6 @@ var doWithLock = async (opts, task) => {
|
|
|
5978
5991
|
console.warn("lock error");
|
|
5979
5992
|
if (e.name === "LockError") {
|
|
5980
5993
|
if (opts.type === "try_once" /* TRY_ONCE */) {
|
|
5981
|
-
console.warn(e);
|
|
5982
5994
|
return { executed: false };
|
|
5983
5995
|
} else {
|
|
5984
5996
|
console.error(e);
|
|
@@ -5993,7 +6005,7 @@ var doWithLock = async (opts, task) => {
|
|
|
5993
6005
|
await lock.unlock();
|
|
5994
6006
|
}
|
|
5995
6007
|
}
|
|
5996
|
-
}
|
|
6008
|
+
}
|
|
5997
6009
|
|
|
5998
6010
|
// ../backend-core/src/platform/tenants.ts
|
|
5999
6011
|
var TENANT_DOC = StaticDatabases.PLATFORM_INFO.docs.tenants;
|
|
@@ -12928,8 +12940,10 @@ function makeVariableKey(queryId, variable) {
|
|
|
12928
12940
|
}
|
|
12929
12941
|
function threadSetup() {
|
|
12930
12942
|
if (environment_default.isTest() || environment_default.DISABLE_THREADING || !environment_default.isInThread()) {
|
|
12943
|
+
console.debug(`[${environment_default.FORKED_PROCESS_NAME}] thread setup skipped`);
|
|
12931
12944
|
return;
|
|
12932
12945
|
}
|
|
12946
|
+
console.debug(`[${environment_default.FORKED_PROCESS_NAME}] thread setup running`);
|
|
12933
12947
|
init8();
|
|
12934
12948
|
}
|
|
12935
12949
|
async function checkCacheForDynamicVariable(queryId, variable) {
|