querysub 0.145.0 → 0.147.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "querysub",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.147.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"node-forge": "https://github.com/sliftist/forge#e618181b469b07bdc70b968b0391beb8ef5fecd6",
|
|
25
25
|
"pako": "^2.1.0",
|
|
26
26
|
"preact": "^10.11.3",
|
|
27
|
-
"socket-function": "^0.
|
|
27
|
+
"socket-function": "^0.82.0",
|
|
28
28
|
"terser": "^5.31.0",
|
|
29
29
|
"typesafecss": "^0.6.3",
|
|
30
30
|
"yaml": "^2.5.0",
|
|
@@ -291,6 +291,10 @@ class PathValueCommitter {
|
|
|
291
291
|
paths.add(hash);
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
|
+
|
|
295
|
+
// TODO: Ugh... rejections on initialSync might the wrong solution. I think we have to just remove the values,
|
|
296
|
+
// even though this makes debugging harder, in order to prevent the rejections from sticking around.
|
|
297
|
+
|
|
294
298
|
for (let batch of batched) {
|
|
295
299
|
if (!batch.initialTrigger) continue;
|
|
296
300
|
for (let pathValue of batch.pathValues) {
|
|
@@ -367,8 +367,8 @@ async function edgeNodeFunction(config: {
|
|
|
367
367
|
let PARALLEL_FACTOR = 3;
|
|
368
368
|
for (let i = 0; i < edgeNodes.length; i += PARALLEL_FACTOR) {
|
|
369
369
|
let node = await new Promise<EdgeNodeConfig | undefined>(resolve => {
|
|
370
|
+
let finished = 0;
|
|
370
371
|
for (let j = 0; j < PARALLEL_FACTOR; j++) {
|
|
371
|
-
let finished = 0;
|
|
372
372
|
((async () => {
|
|
373
373
|
try {
|
|
374
374
|
let node = edgeNodes[i + j];
|
|
@@ -422,11 +422,6 @@ function predictCall(config: {
|
|
|
422
422
|
logErrors(predictPromise);
|
|
423
423
|
|
|
424
424
|
let didCancel = false;
|
|
425
|
-
// ALWAYS reject the prediction eventually, in case the function runner server is down.
|
|
426
|
-
// - ALSO, once it goes back up, the write will be too far in the future, and our lock won't be rejected.
|
|
427
|
-
// And don't really want endTime to be infinitely in the future, as then cleanup code has a harder time
|
|
428
|
-
// removing the lock, as then in theory it can always be rejected, no matter how long we wait.
|
|
429
|
-
setTimeout(rejectPrediction, Querysub.PREDICTION_MAX_LIFESPAN);
|
|
430
425
|
function rejectPrediction() {
|
|
431
426
|
if (didCancel) return;
|
|
432
427
|
didCancel = true;
|
|
@@ -439,9 +434,18 @@ function predictCall(config: {
|
|
|
439
434
|
reason: "prediction timeout rejected",
|
|
440
435
|
}]);
|
|
441
436
|
}
|
|
442
|
-
|
|
443
|
-
|
|
437
|
+
|
|
438
|
+
setTimeout(cleanupPrediction, Querysub.PREDICTION_MAX_LIFESPAN);
|
|
439
|
+
function cleanupPrediction() {
|
|
444
440
|
if (didCancel) return;
|
|
441
|
+
|
|
442
|
+
// ALWAYS reject the prediction, in case the function runner server is down.
|
|
443
|
+
// - ALSO, once it goes back up, the write likely will be too far in the future, so our lock won't be rejected,
|
|
444
|
+
// will will cause the bad value to stick around.
|
|
445
|
+
// We could fix this with an endTime infinitely in the future, but then the lock can never be GCed,
|
|
446
|
+
// which create a memory leak.
|
|
447
|
+
rejectPrediction();
|
|
448
|
+
|
|
445
449
|
if (Querysub.AUDIT_PREDICTIONS && predictions) {
|
|
446
450
|
const afterTime = { time: call.runAtTime.time, version: Number.MAX_SAFE_INTEGER, creatorId: 0 };
|
|
447
451
|
// Clone predictions, to strip symbols
|
|
@@ -33,24 +33,30 @@ export class ActionsHistory {
|
|
|
33
33
|
}
|
|
34
34
|
public static OnRead(values: PathValue[]) {
|
|
35
35
|
if (ClientWatcher.DEBUG_READS && values.length > 0) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
values = values.filter(x => !x.path.startsWith(LOCAL_DOMAIN_PATH));
|
|
37
|
+
if (values.length > 0) {
|
|
38
|
+
let now = Date.now();
|
|
39
|
+
let oldest = Math.min(...values.map(x => x.time.time).filter(x => x), now);
|
|
40
|
+
group(ClientWatcher.DEBUG_READS_EXPANDED)(`(${now - epoch}ms, ${now}) Read count ${values.length}, ${(Date.now() - oldest).toFixed()}ms old`);
|
|
41
|
+
for (let value of values) {
|
|
42
|
+
console.log(blue(debugPathValuePath(value)), "===", pathValueSerializer.getPathValue(value), `(${value.valid ? "valid" : "invalid"})`);
|
|
43
|
+
}
|
|
44
|
+
console.groupEnd();
|
|
41
45
|
}
|
|
42
|
-
console.groupEnd();
|
|
43
46
|
}
|
|
44
47
|
if (!ActionsHistory.LOG_ACTION_HISTORY) return;
|
|
45
48
|
}
|
|
46
49
|
public static OnWrite(values: PathValue[]) {
|
|
47
50
|
if (ClientWatcher.DEBUG_WRITES) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
values = values.filter(x => !x.path.startsWith(LOCAL_DOMAIN_PATH));
|
|
52
|
+
if (values.length > 0) {
|
|
53
|
+
let now = Date.now();
|
|
54
|
+
group(ClientWatcher.DEBUG_WRITES_EXPANDED)(green(`(${now - epoch}ms, ${now}) Committing writes ${values.length}`));
|
|
55
|
+
for (let value of values) {
|
|
56
|
+
console.log(green(debugPathValuePath(value)), "=", pathValueSerializer.getPathValue(value), `(${value.valid ? "valid" : "invalid"})`);
|
|
57
|
+
}
|
|
58
|
+
console.groupEnd();
|
|
52
59
|
}
|
|
53
|
-
console.groupEnd();
|
|
54
60
|
}
|
|
55
61
|
if (!ActionsHistory.LOG_ACTION_HISTORY) return;
|
|
56
62
|
}
|