querysub 0.32.0 → 0.34.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.32.0",
3
+ "version": "0.34.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",
@@ -228,6 +228,14 @@ export function getBrowserUrlNode() {
228
228
  return rootLocation;
229
229
  }
230
230
 
231
+ export async function triggerNodeChange() {
232
+ await syncNodesNow();
233
+ await Promise.allSettled(Array.from(allNodeIds2).map(async nodeId => {
234
+ if (isOwnNodeId(nodeId)) return;
235
+ await timeoutToUndefinedSilent(timeInSecond * 5, errorToUndefinedSilent(NodeDiscoveryController.nodes[nodeId].addNode(getOwnNodeId())));
236
+ }));
237
+ }
238
+
231
239
  let seenNodesForEvilDNS = new Set<string>();
232
240
  async function syncArchives() {
233
241
  if (isServer()) {
@@ -295,6 +303,7 @@ async function runHeartbeatAuditLoop() {
295
303
  });
296
304
  }
297
305
 
306
+ // NOTE: Not just dead nodes, but also nodes that are unreachable, such as developer nodes.
298
307
  let deadNodes = new Map<string, number>();
299
308
  async function fastMemorySync() {
300
309
  let aliveNodes = new Set(Array.from(allNodeIds2).filter(x => x !== getOurNodeId()));
@@ -2,7 +2,7 @@ import { SocketFunction } from "socket-function/SocketFunction";
2
2
  import { measureFnc, measureWrap } from "socket-function/src/profiling/measure";
3
3
  import { errorToUndefined, errorToUndefinedSilent, ignoreErrors, logErrors, timeoutToUndefined, timeoutToUndefinedSilent } from "../errors";
4
4
  import { PromiseObj } from "../promise";
5
- import { getAllNodeIds, getBrowserUrlNode, getOwnNodeId, isNodeDiscoveryLogging, isOwnNodeId, onNodeDiscoveryReady, watchDeltaNodeIds, watchNodeIds } from "../-f-node-discovery/NodeDiscovery";
5
+ import { getAllNodeIds, getBrowserUrlNode, getOwnNodeId, isNodeDiscoveryLogging, isOwnNodeId, onNodeDiscoveryReady, triggerNodeChange, watchDeltaNodeIds, watchNodeIds } from "../-f-node-discovery/NodeDiscovery";
6
6
  import { PathValueController } from "./PathValueController";
7
7
  import { MAX_ACCEPTED_AUTHORITY_STARTUP_TIME, PathValueSnapshot, STARTUP_CUTOFF_TIME, authorityStorage, matchesParentRangeFilterPart } from "./pathValueCore";
8
8
  import { pathValueArchives } from "./pathValueArchives";
@@ -453,6 +453,8 @@ class NodePathAuthorities {
453
453
  for (let nodeId of await getAllNodeIds()) {
454
454
  ignoreErrors(PathController.nodes[nodeId].broadcastReadReady(readyTime));
455
455
  }
456
+ // Tell all nodes we exist, in case we started at the same time.
457
+ await triggerNodeChange();
456
458
 
457
459
  if (this.getSelfAuthorities().length > 0) {
458
460
  console.log(green(`Became an authority for:`));
package/src/config.ts CHANGED
@@ -54,5 +54,8 @@ export function authorityRaw() {
54
54
  }
55
55
 
56
56
  export function isPublic() {
57
+ if (!isNode()) {
58
+ return !location.hostname.startsWith("noproxy.");
59
+ }
57
60
  return !!yargObj.public;
58
61
  }