querysub 0.20.0 → 0.21.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.20.0",
3
+ "version": "0.21.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",
@@ -351,6 +351,8 @@ async function runMainSyncLoops(discoveryReady: PromiseObj<void>) {
351
351
  await timeoutToUndefinedSilent(timeInSecond * 5, errorToUndefinedSilent(NodeDiscoveryController.nodes[nodeId].addNode(getOwnNodeId())));
352
352
  }));
353
353
 
354
+ console.log(magenta(`Node discovery is ready and first heartbeat + sync is done`));
355
+
354
356
  await runInfinitePoll(HEARTBEAT_INTERVAL, async function nodeDiscoverHeartbeat() {
355
357
  // If we waited too long, other nodes might think we are dead. In which case, we SHOULD terminate.
356
358
  if (!isNoNetwork()) {
@@ -16,7 +16,7 @@ import { isNode, isNodeTrue, nextId, timeInSecond } from "socket-function/src/mi
16
16
  import { getPathStr2, getPathStr3 } from "../path";
17
17
  import { consistentHash } from "../misc/hash";
18
18
  import { setExternalHotReloading } from "socket-function/hot/HotReloadController";
19
- import { isPublic } from "../config";
19
+ import { devDebugbreak, isPublic } from "../config";
20
20
  import { SocketFunction } from "socket-function/SocketFunction";
21
21
  import { requiresNetworkTrustHook } from "../-d-trust/NetworkTrust2";
22
22
  import { getControllerNodeId, getControllerNodeIdList } from "../-g-core-values/NodeCapabilities";
@@ -281,6 +281,10 @@ async function getModuleFromSpecBase(
281
281
  deployPath = packagePath + "deploy.ts";
282
282
  }
283
283
 
284
+ if (path.startsWith("/root")) {
285
+ devDebugbreak();
286
+ }
287
+
284
288
  console.log(blue(`require(${JSON.stringify(path)})`));
285
289
 
286
290
  // Set functionSpec for the next synchronous evaluation
@@ -6,10 +6,11 @@ import { requiresNetworkTrustHook } from "../-d-trust/NetworkTrust2";
6
6
  import { cache } from "socket-function/src/caching";
7
7
  import { TimeGrouper } from "./TimeGrouper";
8
8
  import { runInfinitePollCallAtStart } from "socket-function/src/batching";
9
- import { timeInMinute } from "socket-function/src/misc";
9
+ import { throttleFunction, timeInMinute } from "socket-function/src/misc";
10
10
  import { formatNumber, formatPercent, formatTime } from "socket-function/src/formatting/format";
11
11
  import os from "os";
12
12
  import { isNode } from "typesafecss";
13
+ import { diskLog } from "../diagnostics/logs/diskLogger";
13
14
 
14
15
  // Undefined means we infer the column
15
16
  // Null means the column is removed
@@ -40,8 +41,12 @@ export function registerNodeMetadata(getter: ExtraMetadata) {
40
41
 
41
42
  let stateValues = cache((title: string, format: (value: number) => string): { (value: number): void } => {
42
43
  let timeGrouper = new TimeGrouper();
44
+ let logToDisk = throttleFunction(timeInMinute, (value: number) => {
45
+ diskLog(title, { value, formatted: format(value) });
46
+ });
43
47
  function onValue(value: number) {
44
48
  timeGrouper.onValueChanged(value);
49
+ void logToDisk(value);
45
50
  }
46
51
  registerNodeMetadata({
47
52
  columnName: title,
@@ -54,8 +59,12 @@ let stateValues = cache((title: string, format: (value: number) => string): { (v
54
59
  });
55
60
  let eventValues = cache((title: string, format: (value: number) => string): { (value: number): void } => {
56
61
  let timeGrouper = new TimeGrouper();
62
+ let logToDisk = throttleFunction(timeInMinute, (value: number) => {
63
+ diskLog(title, { value, formatted: format(value) });
64
+ });
57
65
  function onValue(value: number) {
58
66
  timeGrouper.onValueChanged(value);
67
+ void logToDisk(value);
59
68
  }
60
69
  registerNodeMetadata({
61
70
  columnName: title,
@@ -97,7 +106,8 @@ if (isNode()) {
97
106
  logNodeStateStats("System|CPU Count", formatNumber)(cpuCount);
98
107
 
99
108
  let load = os.loadavg();
100
- logNodeStateStats("System|Average Free Cores", formatPercent)((1 - load[0]) * os.cpus().length);
109
+ logNodeStateStats("System|Average Load", formatPercent)(load[0]);
110
+ logNodeStateStats("System|Average Free Cores", formatPercent)((os.cpus().length - load[0]));
101
111
 
102
112
  });
103
113
  }
@@ -182,7 +182,7 @@ export class DiskLoggerPage extends qreact.Component {
182
182
  if (!canHaveChildren(value)) {
183
183
  // Add to search as well
184
184
  if (filterURL.value.trim()) {
185
- filterURL.value += " | ";
185
+ filterURL.value += " & ";
186
186
  }
187
187
  filterURL.value += String(value);
188
188
  }
@@ -244,17 +244,17 @@ export class DiskLoggerPage extends qreact.Component {
244
244
  };
245
245
 
246
246
  table.columns["remaining"] = {
247
+ title: "Object",
247
248
  formatter(value, context) {
248
249
  return <ObjectDisplay
249
250
  value={context?.row}
250
- excludedFields={fullSelectedFields}
251
251
  onClickKey={path => addPath(path)}
252
252
  onClickValue={(path, value) => {
253
253
  addPath(path);
254
254
  if (!canHaveChildren(value)) {
255
255
  // Add to search as well
256
256
  if (filterURL.value.trim()) {
257
- filterURL.value += " | ";
257
+ filterURL.value += " & ";
258
258
  }
259
259
  filterURL.value += String(value);
260
260
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { batchFunction, runInfinitePoll } from "socket-function/src/batching";
3
- import { timeInDay, timeInHour } from "socket-function/src/misc";
3
+ import { nextId, timeInDay, timeInHour } from "socket-function/src/misc";
4
4
  import { getStorageDir, getStorageFolder } from "../../fs";
5
5
  import fs from "fs";
6
6
  import { canHaveChildren } from "socket-function/src/types";
@@ -188,9 +188,11 @@ function safeCopyObject<T>(obj: T): T {
188
188
  return { errorCopying: e.messsage } as any;
189
189
  }
190
190
  }
191
+ let __baseThreadId = nextId();
191
192
  function packageLogObj(args: unknown[]): LogObj {
192
193
  let logObj: LogObj = {
193
194
  time: Date.now(),
195
+ __baseThreadId,
194
196
  };
195
197
  for (let part of globalContextParts) {
196
198
  Object.assign(logObj, safeCopyObject(part()));