querysub 0.268.0 → 0.270.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.268.0",
3
+ "version": "0.270.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",
@@ -323,6 +323,7 @@ export function getSpecFromModule(module: NodeJS.Module): LoadFunctionSpec | und
323
323
  async function getModuleFromSpecBase(
324
324
  spec: LoadFunctionSpec
325
325
  ): Promise<NodeJS.Module> {
326
+ console.log(blue(`Loading module for ${JSON.stringify(spec)}`));
326
327
  // Register ourself as overlapping, to prevent ambient modules from being set in this way.
327
328
  registerSpec(module.filename, "overlapping");
328
329
 
@@ -247,11 +247,17 @@ async function edgeNodeFunction(config: {
247
247
  progressUI.setMessage("Finding available server...");
248
248
  let retryCount = 0;
249
249
  while (true) {
250
+ let cached = !!cachedConfig;
250
251
  try {
251
252
  let booted = await tryToBoot();
252
253
  if (booted) break;
253
254
  } catch (e) {
254
255
  console.error(e);
256
+ // If it's a cached failure, it might be that the cache is out of date, so rerun immediately without waiting or an error message.
257
+ if (cached) {
258
+ cachedConfig = undefined;
259
+ continue;
260
+ }
255
261
  }
256
262
  retryCount++;
257
263
  progressUI.setMessage(`No available servers, retried ${retryCount++} times`);
@@ -290,6 +296,7 @@ async function edgeNodeFunction(config: {
290
296
  }
291
297
  async function getEdgeNodeConfig(): Promise<EdgeNodeConfig> {
292
298
  let edgeIndex = cachedConfig || await (await fetch(config.edgeNodeConfigURL)).json() as EdgeNodesIndex;
299
+ cachedConfig = undefined;
293
300
 
294
301
  edgeIndex.edgeNodes.sort((a, b) => -(a.bootTime - b.bootTime));
295
302
  // Filter out duplicate hostnames (taking the max bootTime). We can't have multiple services using the same port, so duplicates are DEFINITELY dead. This fixes some issues with accessing old services, and generally makes reading the logs easier.
@@ -300,7 +307,6 @@ async function edgeNodeFunction(config: {
300
307
  return true;
301
308
  });
302
309
 
303
- cachedConfig = undefined;
304
310
  let liveHashForced = false;
305
311
  if (Date.now() < liveHashOverrideExpiryTime) {
306
312
  liveHashForced = true;
@@ -801,6 +801,8 @@ export class Querysub {
801
801
  let existingRecords = await getRecords("A", getDomain());
802
802
  if (ip !== "127.0.0.1") {
803
803
  let validRecords: string[] = [];
804
+ // Ignore ourself, we want OTHER records.
805
+ existingRecords = existingRecords.filter(x => x !== ip);
804
806
  await Promise.all(existingRecords.map(async (record) => {
805
807
  let isListening = await timeoutToUndefined(timeInSecond * 10, testTCPIsListening(record, 443));
806
808
  if (isListening) {
@@ -1,8 +1,3 @@
1
- 8) Fix deploy user notification issue, where the refresh button doesn't work?
2
- - For application level updates
3
- - Just an application commit, then deploy the service, then the refresh button should show up, and work
4
-
5
-
6
1
  8) Use a special service for the HTTP bootstrapper, and then have 2 others that are on other ports
7
2
  --bootstraponly is added, and should work?
8
3
 
@@ -95,6 +95,8 @@ export function getSyncedController<T extends SocketRegistered>(
95
95
  */
96
96
  reads?: { [key in keyof T["nodes"][""]]?: string[]; };
97
97
  writes?: { [key in keyof T["nodes"][""]]?: string[]; };
98
+ // TODO: Add a flag to give timeouts, so values are automatically refreshed every once in a while, so pages don't get too stale?
99
+ // - BUT with a "softRefresh", so we don't trigger a re-render, we only update it if it is accessed again!
98
100
  }
99
101
  ): {
100
102
  (nodeId: string): {