querysub 0.426.0 → 0.427.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.426.0",
3
+ "version": "0.427.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",
@@ -651,7 +651,7 @@ export class PathRouter {
651
651
  // TODO: We could maybe match a partial match. However, even that is suspect. The site being partially broken is almost worse than it being completely broken. We should just get ALL the shards running again...
652
652
 
653
653
  // NOTE: We *could* actually synchronize it even if it doesn't have a prefix shard as we can fall back to just the full path sharding. However, it becomes very complicated if we want a specific range, and then it becomes complicated if it then switches to prefix hashing (With the nodes that were using the full path hashing slowly going away). AND... key synchronization IS slow, so it's good to discourage it in general.
654
- console.error(`Want to sync a prefix which is not under an existing prefix, nor equal to a prefix. 1) The servers are down. 2) Don't access the .keys() 3) call addRoutingPrefixForDeploy to add a route/parent route explicitly (as is done in PathFunctionRunner.ts). Path: ${JSON.stringify(path)}`, { path, allSources });
654
+ console.error(`Want to sync a prefix which is not under an existing prefix, nor equal to a prefix. 1) The servers are down. 2) Don't access the .keys() 3) call addRoutingPrefixForDeploy to add a route/parent route explicitly (as is done in PathFunctionRunner.ts). Path: ${JSON.stringify(path)}`, { path, allSources: allSources.map(x => x.authoritySpec) });
655
655
  }
656
656
  return { nodes: [] };
657
657
  }
@@ -369,8 +369,10 @@ class PathWatcher {
369
369
 
370
370
  // initialTriggers.parentPaths => triggerPaths
371
371
  for (let parentPath of initialTriggers.parentPaths) {
372
- let valuePaths = authorityStorage.getPathsFromParent(parentPath);
372
+ // NOTE: We have to trigger all of the values without the hacked path restriction. This should be safe, if a little bit inefficient, because we're still not going to send the values to watchers who aren't watching them. But we need to trigger all of it because it might be the case that we had synchronized 99% of the path and someone was watching 100% of the path and we just finished synchronizing the last 1%. So the parent path trigger that we received only has 1%, but we need to send everything. And it's too complicated to determine exactly what we need to send as in the intersection of all the watchers. So it's easier to just trigger all the value paths and what they're watching will naturally be sent.
373
+ let valuePaths = authorityStorage.getPathsFromParent(hack_stripPackedPath(parentPath));
373
374
  for (let valuePath of valuePaths || []) {
375
+ if (!authorityStorage.isSynced(valuePath)) continue;
374
376
  // IMPORTANT! Add all the values to the initial triggers so then later we not only trigger them but know their initial trigger so we can make sure that the is initial trigger logic for each value runs as well.
375
377
  initialTriggers.values.add(valuePath);
376
378
  triggerPaths.add(valuePath);
@@ -378,7 +380,9 @@ class PathWatcher {
378
380
 
379
381
  let latestParentWatches = this.parentWatchers.get(hack_stripPackedPath(parentPath));
380
382
  if (!latestParentWatches) continue;
381
- for (let { watchers } of latestParentWatches.values()) {
383
+ for (let [packedPath, { watchers }] of latestParentWatches) {
384
+ // ONLY trigger, if packedPath is fully synchronized
385
+ if (!authorityStorage.isParentSynced(packedPath)) continue;
382
386
  for (let watcher of watchers) {
383
387
  if (onlyTriggerNodeId && watcher !== onlyTriggerNodeId) continue;
384
388
  let changes = changedPerCallbacks.get(watcher);
@@ -386,7 +390,7 @@ class PathWatcher {
386
390
  changes = { values: new Set(), initialTriggers: { values: new Set(), parentPaths: new Set() } };
387
391
  changedPerCallbacks.set(watcher, changes);
388
392
  }
389
- changes.initialTriggers.parentPaths.add(parentPath);
393
+ changes.initialTriggers.parentPaths.add(packedPath);
390
394
  }
391
395
  }
392
396
  }