querysub 0.21.0 → 0.23.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
|
@@ -230,6 +230,7 @@ class NodePathAuthorities {
|
|
|
230
230
|
return;
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
let time = Date.now();
|
|
233
234
|
let createTime = await errorToUndefinedSilent(PathController.nodes[nodeId].getCreateTime());
|
|
234
235
|
if (createTime === undefined) {
|
|
235
236
|
// Don't log for 127-0-0-1, as it usually fails, and is mostly a development optimization
|
|
@@ -238,7 +239,8 @@ class NodePathAuthorities {
|
|
|
238
239
|
}
|
|
239
240
|
return;
|
|
240
241
|
}
|
|
241
|
-
|
|
242
|
+
time = Date.now() - time;
|
|
243
|
+
console.log(blue(`Identifying ${nodeId} as a path authority. ping latency = ${formatTime(time)}`));
|
|
242
244
|
this.authorities.set(nodeId, {
|
|
243
245
|
nodeId,
|
|
244
246
|
self: nodeId.startsWith("127-0-0-1."),
|
|
@@ -23,7 +23,7 @@ import { LOCAL_DOMAIN_PATH } from "../0-path-value-core/NodePathAuthorities";
|
|
|
23
23
|
import { registerPeriodic } from "../diagnostics/periodic";
|
|
24
24
|
import { remoteWatcher } from "../1-path-client/RemoteWatcher";
|
|
25
25
|
import { Schema2, Schema2Fncs } from "./schema2";
|
|
26
|
-
import { devDebugbreak, getDomain } from "../config";
|
|
26
|
+
import { devDebugbreak, getDomain, isPublic } from "../config";
|
|
27
27
|
|
|
28
28
|
import type { CallSpec } from "../3-path-functions/PathFunctionRunner";
|
|
29
29
|
import type { FunctionMetadata } from "../3-path-functions/syncSchema";
|
|
@@ -1813,9 +1813,9 @@ export function registerSchemaPrefix(config: {
|
|
|
1813
1813
|
if (!list) {
|
|
1814
1814
|
schemaPrefixes.push(list = { len, prefixes: new Map() });
|
|
1815
1815
|
}
|
|
1816
|
-
if (isNode()) {
|
|
1816
|
+
if (isNode() && !globalThis.isHotReloading?.()) {
|
|
1817
1817
|
if (list.prefixes.has(config.prefixPathStr)) {
|
|
1818
|
-
throw new Error(`Prefix matches only work due to only having one version of the code ever load (except for during hot reloading development clientside). If we try to render multiple versions of the same code serverside (ex, because we pre-loaded new code during a deploy), it will break, as we can't distinguish them. ADD GIT HASH TO PREFIX SCHEMAS TO FIX THIS
|
|
1818
|
+
throw new Error(`Prefix matches only work due to only having one version of the code ever load (except for during hot reloading development clientside). If we try to render multiple versions of the same code serverside (ex, because we pre-loaded new code during a deploy), it will break, as we can't distinguish them. ADD GIT HASH TO PREFIX SCHEMAS TO FIX THIS! Tried to double load ${config.prefixPathStr}`);
|
|
1819
1819
|
}
|
|
1820
1820
|
}
|
|
1821
1821
|
list.prefixes.set(config.prefixPathStr, config.schema);
|
|
@@ -90,11 +90,11 @@ if (isNode()) {
|
|
|
90
90
|
const free = os.freemem();
|
|
91
91
|
const total = os.totalmem();
|
|
92
92
|
|
|
93
|
-
let constrainedMemory = process.constrainedMemory();
|
|
94
|
-
|
|
95
93
|
logNodeStateStats("System|Memory Free", x => formatNumber(x) + "B")(free);
|
|
96
94
|
logNodeStateStats("System|Memory Free %", formatPercent)(free / total);
|
|
97
|
-
|
|
95
|
+
|
|
96
|
+
let constrainedMemory = process.constrainedMemory();
|
|
97
|
+
if (constrainedMemory !== undefined && constrainedMemory < 2 ** 48) {
|
|
98
98
|
logNodeStateStats("System|Constrained Memory", x => formatNumber(x) + "B")(constrainedMemory);
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -54,7 +54,7 @@ type NodeData = {
|
|
|
54
54
|
columns: ColumnsType;
|
|
55
55
|
row: RowType;
|
|
56
56
|
};
|
|
57
|
-
|
|
57
|
+
loadTime?: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
module.hotreload = true;
|
|
@@ -81,6 +81,7 @@ export class NodeViewer extends qreact.Component {
|
|
|
81
81
|
let ourIP = await controller.getCallerIP();
|
|
82
82
|
|
|
83
83
|
await Promise.allSettled(nodeIds.map(async nodeId => {
|
|
84
|
+
let time = Date.now();
|
|
84
85
|
let data: NodeData = { nodeId };
|
|
85
86
|
try {
|
|
86
87
|
data.table = await controller.getMiscInfo(nodeId);
|
|
@@ -100,6 +101,8 @@ export class NodeViewer extends qreact.Component {
|
|
|
100
101
|
} catch (e: any) {
|
|
101
102
|
data.apiError = "Error: " + e.stack;
|
|
102
103
|
}
|
|
104
|
+
time = Date.now() - time;
|
|
105
|
+
data.loadTime = time;
|
|
103
106
|
Querysub.commit(() => {
|
|
104
107
|
this.state.nodes[nodeId] = atomicObjectWrite(data);
|
|
105
108
|
});
|
|
@@ -182,7 +185,7 @@ export class NodeViewer extends qreact.Component {
|
|
|
182
185
|
}
|
|
183
186
|
|
|
184
187
|
let builtinGroups = {
|
|
185
|
-
"Default": ["buttons", "devToolsURL", "nodeId", "ip", "uptime", "Heap", "All Memory", "Blocking Lag", "port", "threadId", "machineId", "apiError", "live_entryPoint"],
|
|
188
|
+
"Default": ["buttons", "devToolsURL", "nodeId", "ip", "uptime", "loadTime", "Heap", "All Memory", "Blocking Lag", "port", "threadId", "machineId", "apiError", "live_entryPoint"],
|
|
186
189
|
};
|
|
187
190
|
// Column => group
|
|
188
191
|
let builtInGroupsLookup = new Map<string, string>();
|
|
@@ -263,7 +266,6 @@ export class NodeViewer extends qreact.Component {
|
|
|
263
266
|
formatter: (obj) => {
|
|
264
267
|
let str = String(obj);
|
|
265
268
|
if (str.startsWith("http")) return formatValue(obj);
|
|
266
|
-
https://noproxy.querysub.com:1111/?page=test&showingmanagement&managementpage=DiskLoggerPage&nodeId=b4d19fba5f79d48c3.b68f46ffaffad0636.querysub.com%3A41863&filter=%22%5C%22__nodeId%5C%22%3A%5C%22b654f522bf3a67c49.b68f46ffaffad0636.querysub.com%3A33473%5C%22%22
|
|
267
269
|
|
|
268
270
|
return (
|
|
269
271
|
<ATag values={[
|
|
@@ -277,6 +279,7 @@ export class NodeViewer extends qreact.Component {
|
|
|
277
279
|
},
|
|
278
280
|
},
|
|
279
281
|
ip: {},
|
|
282
|
+
loadTime: { formatter: "timeSpan" },
|
|
280
283
|
...x.table?.columns,
|
|
281
284
|
//capabilities: null,
|
|
282
285
|
apiError: { formatter: "error" },
|
|
@@ -353,8 +356,12 @@ class NodeViewerControllerBase {
|
|
|
353
356
|
await forwardPort({ internalPort: externalPort, externalPort: externalPort, });
|
|
354
357
|
|
|
355
358
|
tlsServer.on("secureConnection", (socket) => {
|
|
356
|
-
|
|
357
|
-
|
|
359
|
+
let matchedIP = (
|
|
360
|
+
socket.remoteAddress === callerIP ||
|
|
361
|
+
callerIP === "127.0.0.1" && socket.remoteAddress === ourIP
|
|
362
|
+
);
|
|
363
|
+
if (!matchedIP) {
|
|
364
|
+
console.error(`Rejecting connection from ${socket.remoteAddress}, expected ${callerIP} ${callerIP === "127.0.0.1" && `or ${ourIP}` || ""}`);
|
|
358
365
|
socket.end();
|
|
359
366
|
return;
|
|
360
367
|
}
|
|
@@ -375,7 +382,7 @@ class NodeViewerControllerBase {
|
|
|
375
382
|
let ourDomain = ourIP.replaceAll(".", "-") + "." + getDomain();
|
|
376
383
|
await setRecord("A", ourDomain, ourIP);
|
|
377
384
|
|
|
378
|
-
console.log(
|
|
385
|
+
console.log(`Inspect forward ${ourDomain}:${finalPort} => ${baseNodeIPResolved}:${externalPort} => 127.0.0.1:${internalPort}, for ${callerIP}`);
|
|
379
386
|
|
|
380
387
|
return internalInspectURL.replace(`ws=127.0.0.1:${internalPort}`, `wss=${ourDomain}:${finalPort}`);
|
|
381
388
|
}
|