querysub 0.481.0 → 0.482.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.481.0",
3
+ "version": "0.482.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",
@@ -542,8 +542,9 @@ export class ArchivesBackblaze {
542
542
  || err.stack.includes(`"internal_error"`)
543
543
  || err.stack.includes(`ENOBUFS`)
544
544
  ) && Date.now() - this.last503Reset > 60 * 1000) {
545
- console.error(`[${context}] 503 error, waiting and resetting: ${err.message}`);
546
- this.log(`[${context}] 503 error, waiting and resetting: ${err.message}`);
545
+ // Backblades is so flaky that we're just going to warn here.
546
+ console.warn(`[${context}] Backblaze error, waiting and resetting: ${err.message}`);
547
+ this.log(`[${context}] Backblaze error, waiting and resetting: ${err.message}`);
547
548
  this.currentReset = this.currentReset || (async () => {
548
549
  await delay(10 * 1000);
549
550
  // We check again in case, and in the very likely case that this is being run in parallel, we only want to reset once.
@@ -579,7 +580,7 @@ export class ArchivesBackblaze {
579
580
  || err.stack.includes(`ECONNREFUSED`)
580
581
  || err.stack.includes(`ENOBUFS`)
581
582
  ) {
582
- console.error(`[${context}] Retrying in 5s: ${err.message}`);
583
+ console.warn(`[${context}] Retrying in 5s: ${err.message}`);
583
584
  this.log(`[${context}] ${err.message} retrying in 5s`);
584
585
  await delay(5000);
585
586
  return this.apiRetryLogic(context, fnc, retries - 1);
@@ -672,10 +672,9 @@ export class PathRouter {
672
672
 
673
673
 
674
674
  if (!config?.onlyOwnNodes) {
675
- // 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...
676
675
 
677
676
  // 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.
678
- 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) });
677
+ console.error(`Want to sync a prefix which is not under an existing prefix, nor equal to a prefix. 1) The servers are down. 1.5) The servers are in an inconsistent state (one shard range added a parent path, the other didn't). 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) });
679
678
  }
680
679
  return { nodes: [] };
681
680
  }
@@ -390,6 +390,20 @@ class ValidStateComputer {
390
390
 
391
391
  for (let pathValue of valueGroup) {
392
392
  let prevValidState = prevValidStates.get(pathValue);
393
+ if (valid && prevValidState === false) {
394
+ console.info(`Accepting value that was previously rejected`, {
395
+ path: pathValue.path,
396
+ timeId: pathValue.time.time,
397
+ timeIdFull: pathValue.time,
398
+ });
399
+ }
400
+ if (valid === false && prevValidState === false) {
401
+ console.info(`Valid still rejected after re-evaluation`, {
402
+ path: pathValue.path,
403
+ timeId: pathValue.time.time,
404
+ timeIdFull: pathValue.time,
405
+ });
406
+ }
393
407
 
394
408
  // IMPORTANT! This means if it didn't previously exist and it's presently rejected, we count that as a change, as it this is going from undefined to false. This is actually very useful, as a lot of places want to know if a write is rejected, so they can display it in the UI for the developer.
395
409
  if (valid === prevValidState) continue;
@@ -715,12 +715,12 @@ export class PathValueProxyWatcher {
715
715
  // We exclude undefined, BUT, we include "null", etc.
716
716
  // - This differs from javascript, but... due to how deletions work, we can't/don't differentiate between
717
717
  // a deleted value and undefined, and a lot of things break if deleting a value doesn't remove it from an "in" check!
718
- private hasCallback = (pathStr: string): boolean => {
718
+ public hasCallback = (pathStr: string): boolean => {
719
719
  let value = this.getCallback(pathStr, undefined, "readTransparent");
720
720
  return value?.value !== undefined;
721
721
  };
722
722
 
723
- private setCallback = (pathStr: string, value: unknown, inRecursion = false, allowSpecial = false): void => {
723
+ public setCallback = (pathStr: string, value: unknown, inRecursion = false, allowSpecial = false): void => {
724
724
  if (PathValueProxyWatcher.BREAK_ON_WRITES.size > 0 && proxyWatcher.isAllSynced()) {
725
725
  if (isRecursiveMatch(PathValueProxyWatcher.BREAK_ON_WRITES, pathStr)) {
726
726
  let unwatch = () => removeMatches(PathValueProxyWatcher.BREAK_ON_WRITES, pathStr);
@@ -67,6 +67,7 @@ let aliveCheckers: AliveChecker<any>[] = [];
67
67
  * AND, when nodes haven't auditted the disk, they might be in a different state. So... it should only
68
68
  * be used for values users can't access anymore, and so that won't be noticed when they disappear.
69
69
  */
70
+ export const configGarbageCollection = registerAliveChecker;
70
71
  export function registerAliveChecker<T>(config: AliveChecker<T>) {
71
72
  if (config.lock) {
72
73
  config.lockBasedDelete = true;
@@ -2673,7 +2673,7 @@ function watchUnsyncedComponents(): Set<ExternalRenderClass> {
2673
2673
  return unsyncedComponents;
2674
2674
  }
2675
2675
  function componentRendered(component: QRenderClass) {
2676
- if (component.disposed || Querysub.isAllSynced()) {
2676
+ if (component.disposed || Querysub.isAllSynced({ ignoreAlwaysCommitAllRunsFlag: true })) {
2677
2677
  if (unsyncedComponents.has(component)) {
2678
2678
  unsyncedComponents.delete(component);
2679
2679
  triggerUnsyncedNow();
@@ -415,8 +415,8 @@ export class Querysub {
415
415
  public static anyUnsynced() {
416
416
  return !Querysub.allSynced();
417
417
  }
418
- public static allSynced() {
419
- return proxyWatcher.isAllSynced();
418
+ public static allSynced(config?: { ignoreAlwaysCommitAllRunsFlag?: boolean }) {
419
+ return proxyWatcher.isAllSynced(config);
420
420
  }
421
421
  public static fullySynced = Querysub.allSynced;
422
422
  public static isFullySynced = Querysub.allSynced;
@@ -32,7 +32,7 @@ export class UnsyncedIndicator extends qreact.Component {
32
32
  css.vbox(10).pad(20)
33
33
  .hsla(0, 0, 0, 0.8)
34
34
  .position("fixed")
35
- .bottom(10)
35
+ .left(10)
36
36
  .right(10)
37
37
  .zIndex(1000)
38
38
  }
@@ -58,7 +58,7 @@ export class UnsyncedIndicator extends qreact.Component {
58
58
  return <div
59
59
  class={
60
60
  css
61
- .position("fixed").bottom(0).right(0)
61
+ .position("fixed").bottom(0).left(0)
62
62
  .background("hsl(0, 0%, 10%)").color("hsl(0, 0%, 80%)")
63
63
  .fontSize(12).zIndex(1000)
64
64
  .borderRadius(100)