querysub 0.368.0 → 0.369.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.368.0",
3
+ "version": "0.369.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",
@@ -109,6 +109,10 @@ export function isOwnNodeId(nodeId: string): boolean {
109
109
  return false;
110
110
  }
111
111
 
112
+ export function isNodeIdOnOwnMachineId(nodeId: string): boolean {
113
+ return certs.getMachineId(nodeId) === getOwnMachineId() || nodeId.startsWith("127-0-0-1.");
114
+ }
115
+
112
116
  let nodeOverrides: string[] | undefined;
113
117
  let beforeGetNodeAllId = async () => { };
114
118
  export async function getAllNodeIds() {
@@ -12,7 +12,7 @@ import { ArchivesMemoryCacheStats, createArchivesMemoryCache } from "../../../-a
12
12
  import { registerShutdownHandler } from "../../periodic";
13
13
  import { measureBlock, measureFnc } from "socket-function/src/profiling/measure";
14
14
  import { isNode } from "typesafecss";
15
- import { getOwnMachineId } from "../../../-f-node-discovery/NodeDiscovery";
15
+ import { getOwnMachineId, isNodeIdOnOwnMachineId, isOwnNodeId } from "../../../-f-node-discovery/NodeDiscovery";
16
16
  import { TimeFilePath, TimeFileTree } from "./TimeFileTree";
17
17
  import { LogStreamer } from "./LogStreamer";
18
18
  import { moveLogsToPublic } from "./moveIndexLogsToPublic";
@@ -226,10 +226,11 @@ export class IndexedLogs<T> {
226
226
 
227
227
  private machineNodeCache = new Map<string, string>();
228
228
  private async getMachineNodes(): Promise<string[]> {
229
- let ownMachineId = getOwnMachineId();
230
229
  let nodeIds = await getAllNodeIds();
230
+ nodeIds = nodeIds.filter(x => !isNodeIdOnOwnMachineId(x));
231
231
  let byMachineId = keyByArray(nodeIds, x => getMachineId(x));
232
- byMachineId.delete(ownMachineId);
232
+
233
+ let nextCache = new Map<string, string>();
233
234
 
234
235
  await Promise.all(Array.from(byMachineId.entries()).map(async ([machineId, nodeIds]) => {
235
236
  let added = false;
@@ -244,7 +245,7 @@ export class IndexedLogs<T> {
244
245
  }
245
246
  added = true;
246
247
 
247
- this.machineNodeCache.set(machineId, nodeId);
248
+ nextCache.set(machineId, nodeId);
248
249
  return true;
249
250
  };
250
251
  let cached = this.machineNodeCache.get(machineId);
@@ -261,6 +262,7 @@ export class IndexedLogs<T> {
261
262
  }
262
263
  }));
263
264
 
265
+ this.machineNodeCache = nextCache;
264
266
  return Array.from(this.machineNodeCache.values());
265
267
  }
266
268
 
@@ -358,7 +360,7 @@ export class IndexedLogs<T> {
358
360
  let allResults = new Map<string, IndexedLogResults>();
359
361
  let allDone: Promise<void>[] = [];
360
362
 
361
- if (!config.params.only && (config.params.forceReadPublic || isPublic())) {
363
+ if (config.params.only !== "local" && (config.params.forceReadPublic || isPublic())) {
362
364
  let machineNodes = await this.getMachineNodes();
363
365
  allDone.push(...machineNodes.map(async (machineNode) => {
364
366
  try {
@@ -385,6 +387,7 @@ export class IndexedLogs<T> {
385
387
 
386
388
  // If we're forcefully reading from the public server, but we're not public, the code above will be the only code which adds to results
387
389
  if (!isPublic() && config.params.forceReadPublic) {
390
+ await Promise.all(allDone);
388
391
  return getFinalResults();
389
392
  }
390
393
 
@@ -707,7 +710,6 @@ class IndexedLogClient {
707
710
  indexedLogsName: string;
708
711
  result: unknown;
709
712
  }) {
710
- if (isNode()) return;
711
713
  let indexedLogs = loggerByName.get(config.indexedLogsName);
712
714
  if (!indexedLogs) throw new Error(`Indexed logs ${config.indexedLogsName} not found`);
713
715
  indexedLogs.onFindResult({
@@ -720,7 +722,6 @@ class IndexedLogClient {
720
722
  indexedLogsName: string;
721
723
  results: IndexedLogResults;
722
724
  }): Promise<boolean> {
723
- if (isNode()) return true;
724
725
  let indexedLogs = loggerByName.get(config.indexedLogsName);
725
726
  if (!indexedLogs) throw new Error(`Indexed logs ${config.indexedLogsName} not found`);
726
727
  return await indexedLogs.onResults({
@@ -371,7 +371,7 @@ export class LogViewer3 extends qreact.Component {
371
371
  let paths = await logger.clientGetPaths({
372
372
  startTime: range.startTime,
373
373
  endTime: range.endTime,
374
- only: excludePendingResults.value ? "local" : undefined,
374
+ only: excludePendingResults.value ? "public" : undefined,
375
375
  forceReadPublic: readPublicLogs.value,
376
376
  });
377
377
  allPaths.push(...paths);
@@ -682,7 +682,6 @@ export class LogViewer3 extends qreact.Component {
682
682
  return (
683
683
  <div className={css.vbox(20).pad2(20).fillBoth}>
684
684
  <div className={css.hbox(20)}>
685
- <div>Log Viewer 3</div>
686
685
  <InputLabelURL
687
686
  checkbox
688
687
  label="Exclude Pending Results"
@@ -23,6 +23,8 @@ IMPORTANT! Now I am properly calling shutdown, so none of the streamed logs shou
23
23
  1) Verify isPublic searching works (from our local machine)
24
24
 
25
25
 
26
+ 1) Deploy our changes
27
+
26
28
 
27
29
  2) Create lot of remote server logs
28
30
  - Via our refresh loop