querysub 0.321.0 → 0.323.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.321.0",
3
+ "version": "0.323.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",
@@ -2255,15 +2255,8 @@ registerPeriodic(function checkForZombieWatches() {
2255
2255
  let zombies = Array.from(proxyWatcher.getAllWatchers()).filter(isZombieWatch);
2256
2256
  lastZombieCount = zombies.length;
2257
2257
  if (zombies.length > 0) {
2258
- console.warn(red(`Found ${zombies.length} zombie watchers`));
2259
2258
  let namesSet = new Set(zombies.map(x => x.debugName));
2260
- let topNames = Array.from(namesSet).slice(0, 5);
2261
- for (let name of topNames) {
2262
- console.warn(red(` ${name}`));
2263
- }
2264
- if (namesSet.size > topNames.length) {
2265
- console.warn(red(` ... and ${namesSet.size - topNames.length} more`));
2266
- }
2259
+ console.warn(`Found ${zombies.length} zombie watchers`, { names: Array.from(namesSet) });
2267
2260
  }
2268
2261
  });
2269
2262
 
@@ -517,9 +517,9 @@ export class Querysub {
517
517
  public static getOwnMachineId = getOwnMachineId;
518
518
  public static getSelfMachineId = getOwnMachineId;
519
519
 
520
- public static getOwnNodeId = getOwnNodeId;
521
- public static getSelfNodeId = getOwnNodeId;
522
- public static getOwnThreadId = getOwnThreadId;
520
+ public static getOwnNodeId = () => getOwnNodeId();
521
+ public static getSelfNodeId = () => getOwnNodeId();
522
+ public static getOwnThreadId = () => getOwnThreadId();
523
523
 
524
524
  /** Set ClientWatcher.DEBUG_SOURCES to true for to be populated */
525
525
  public static getTriggerReason() {
@@ -99,7 +99,10 @@ export type DatumStats = {
99
99
  };
100
100
 
101
101
 
102
- export function getFileTimeStamp(path: string): number {
102
+ export function getFileTimeStamp(path: string): {
103
+ startTime: number;
104
+ endTime: number;
105
+ } {
103
106
  let file = path.replaceAll("\\", "/").split("/").at(-1)!;
104
107
  // Remove .log extension and parse as ISO date
105
108
  let dateStr = file.replace(/\.log$/, "");
@@ -107,7 +110,11 @@ export function getFileTimeStamp(path: string): number {
107
110
  if (dateStr.length === 13) { // YYYY-MM-DDTHH format
108
111
  dateStr += ":00:00.000Z";
109
112
  }
110
- return new Date(dateStr).getTime();
113
+ let startTime = new Date(dateStr).getTime();
114
+ return {
115
+ startTime,
116
+ endTime: startTime + timeInHour,
117
+ };
111
118
  }
112
119
 
113
120
 
@@ -284,7 +291,7 @@ export class FastArchiveAppendable<Datum> {
284
291
  try {
285
292
  // We could use modified time here? Although, this is nice if we move files around, and then manually have them moved, although even then... this could cause problem be tripping while we are copying the file, so... maybe this is just wrong?
286
293
  let timeStamp = getFileTimeStamp(fullPath);
287
- if (timeStamp > Date.now() - UPLOAD_THRESHOLD) continue;
294
+ if (timeStamp.endTime > Date.now() - UPLOAD_THRESHOLD) continue;
288
295
 
289
296
  // NOTE: Because we use the same target path, if multiple services do this at the same time it's fine. Not great, but... fine.
290
297
  let backblazePath = FastArchiveAppendable.getBackblazePath({ fileName: file, threadId });
@@ -101,7 +101,7 @@ export class FastArchiveAppendableControllerBase {
101
101
 
102
102
  let fileTimestamp = getFileTimeStamp(file);
103
103
  //console.log(`Found ${new Date(fileTimestamp).toISOString()} in ${threadDir + file}`);
104
- if (fileTimestamp < timeRange.startTime || fileTimestamp > timeRange.endTime) {
104
+ if (fileTimestamp.endTime < timeRange.startTime || fileTimestamp.startTime > timeRange.endTime) {
105
105
  continue;
106
106
  }
107
107
 
@@ -418,8 +418,9 @@ export class FastArchiveAppendableControllerBase {
418
418
  let urlObj = new URL(url);
419
419
  urlObj.hostname = ipDomain;
420
420
  url = urlObj.toString();
421
- let startTime = getFileTimeStamp(file.path);
422
- let endTime = startTime + timeInHour;
421
+ let timeStamp = getFileTimeStamp(file.path);
422
+ let startTime = timeStamp.startTime;
423
+ let endTime = timeStamp.endTime;
423
424
 
424
425
  localFiles.push({
425
426
  nodeId: aliveNodeId,
@@ -7,7 +7,7 @@ import { formatTime } from "socket-function/src/formatting/format";
7
7
  import { InputLabel } from "../../library-components/InputLabel";
8
8
  import { Button } from "../../library-components/Button";
9
9
  import { Querysub } from "../../4-querysub/QuerysubController";
10
- import { timeInHour, timeInMinute } from "socket-function/src/misc";
10
+ import { timeInDay, timeInHour, timeInMinute } from "socket-function/src/misc";
11
11
 
12
12
  // URL parameters for time range
13
13
  export const startTimeParam = new URLParam("startTime", undefined as number | undefined);
@@ -73,6 +73,15 @@ export class TimeRangeSelector extends qreact.Component {
73
73
  }}
74
74
  outerClass={!endTimeParam.value && css.opacity(0.5) || ""}
75
75
  />
76
+ <Button
77
+ hue={110} onClick={() => {
78
+ let now = Date.now();
79
+ startTimeParam.value = now;
80
+ endTimeParam.value = undefined;
81
+ }}
82
+ >
83
+ Set to future data
84
+ </Button>
76
85
  {(endTimeParam.value || startTimeParam.value) && <Button
77
86
  hue={110} onClick={resetToLastDay}
78
87
  >
@@ -386,7 +386,8 @@ class RecentErrors {
386
386
  });
387
387
 
388
388
  private _recentErrors: LogDatum[] = [];
389
- private updateRecentErrors = (objs: LogDatum[]) => {
389
+ private updateRecentErrors = async (objs: LogDatum[]) => {
390
+ objs = await suppressionList.filterObjsToNonSuppressed(objs);
390
391
  let newRecentErrors = limitRecentErrors(objs);
391
392
  // If any changed
392
393
  let prev = new Set(this._recentErrors);
@@ -413,15 +414,15 @@ class RecentErrors {
413
414
  recentErrorsChannel.broadcast(true);
414
415
  });
415
416
 
416
- private addErrors(objs: LogDatum[]) {
417
+ private async addErrors(objs: LogDatum[]) {
417
418
  for (let obj of objs) {
418
419
  this._recentErrors.push(obj);
419
420
  }
420
- this.updateRecentErrors(this._recentErrors);
421
+ await this.updateRecentErrors(this._recentErrors);
421
422
  }
422
423
 
423
424
  public async onSuppressionChanged() {
424
- this.updateRecentErrors(await suppressionList.filterObjsToNonSuppressed(this._recentErrors));
425
+ await this.updateRecentErrors(this._recentErrors);
425
426
  }
426
427
 
427
428
  private scannedHashes = new Set<string>();
@@ -440,7 +441,7 @@ class RecentErrors {
440
441
  noLocalFiles: config.noLocalFiles,
441
442
  });
442
443
  // Filter again, as new suppressions change the errors
443
- this.updateRecentErrors(await suppressionList.filterObjsToNonSuppressed(this._recentErrors));
444
+ await this.updateRecentErrors(this._recentErrors);
444
445
  let recentLimit = 0;
445
446
  const applyRecentLimit = () => {
446
447
  if (this._recentErrors.length < MAX_RECENT_ERRORS) return;
@@ -512,7 +513,7 @@ class RecentErrors {
512
513
  await fd.close();
513
514
  }
514
515
  let newErrors = await scanner.finish();
515
- this.addErrors(newErrors);
516
+ await this.addErrors(newErrors);
516
517
  applyRecentLimit();
517
518
  } catch (e: any) {
518
519
  console.error(`Failed to scan file ${file.url}, size is ${size}, error is:\n${e.stack}`);
@@ -4,7 +4,8 @@ Very small amount of data
4
4
  https://127-0-0-1.querysubtest.com:7007/?hot&enableLogs&page=login&filter=%22431%22&showingmanagement&endTime=1755140880000&startTime=1754950020000&managementpage=LogViewer2
5
5
 
6
6
 
7
- 4) WTF... our http server is trying to run the queue. But we told it not to... Ugh...
7
+ 3) Our time range is not being correctly applied. We have data from 4-5, and are filtering from 4:25 to 5:32, and not matching that data, even though it overlaps a lot.
8
+ 4) API watchers are repeatedly dying. I feel like this is fixable, especially with our logs...
8
9
 
9
10
  5) Update all services, and move them to that machine
10
11
  5) Verify the hezner server can run the site well
@@ -18,6 +19,8 @@ Very small amount of data
18
19
  - https://127-0-0-1.querysubtest.com:7007/?enableLogs&page=login&showingmanagement&endTime=1757835685102.667&managementpage=LogViewer2&machineview=service-detail&startTime=1757745685102.667&serviceId=service-1756340309836&filter=__machineId%20%3D%20a794fbcf7b104c68%20%26%20Edge
19
20
  - Or... maybe logs are lost SOMETIMES, and ALWAYS when we kill the server? Although... that would mean we have multiple issues. Ugh...
20
21
 
22
+ 11) API ranges overlapped? What? I think our code to pick an empty range is wrong?
23
+
21
24
  6) Update URLParam to allow linking it to other parameters, resetting when they change.
22
25
  - With a function, and have standard one beside URLParam (that uses page and tab)
23
26
  - ALSO managementPageURL