querysub 0.304.0 → 0.305.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
|
@@ -19,6 +19,7 @@ import { decodeNodeId, decodeNodeIdAssert } from "../-a-auth/certs";
|
|
|
19
19
|
import { isDefined } from "../misc";
|
|
20
20
|
import { diskLog } from "../diagnostics/logs/diskLogger";
|
|
21
21
|
import { getBootedEdgeNode } from "../-0-hooks/hooks";
|
|
22
|
+
import { EdgeNodeConfig } from "../4-deploy/edgeNodes";
|
|
22
23
|
|
|
23
24
|
let HEARTBEAT_INTERVAL = timeInMinute * 15;
|
|
24
25
|
// Interval which we check other heartbeats
|
|
@@ -221,11 +222,12 @@ export function configRootDiscoveryLocation(config: {
|
|
|
221
222
|
rootDiscoveryNodeId = getNodeId(config.domain, config.port);
|
|
222
223
|
}
|
|
223
224
|
|
|
224
|
-
export function updateRootDiscoveryLocation(
|
|
225
|
+
export function updateRootDiscoveryLocation(edgeNode: EdgeNodeConfig) {
|
|
225
226
|
let prevRootId = getBrowserUrlNode();
|
|
226
227
|
if (!isClient()) {
|
|
227
228
|
throw new Error(`updateRootDiscoveryLocation should only be called in the browser. If not a client, you should be able to discovery new nodes automatically`);
|
|
228
229
|
}
|
|
230
|
+
let nodeId = edgeNode.host;
|
|
229
231
|
let nodeCache = Object.entries(require.cache);
|
|
230
232
|
for (let [path, module] of nodeCache) {
|
|
231
233
|
if (!module) continue;
|
|
@@ -254,6 +256,7 @@ export function updateRootDiscoveryLocation(nodeId: string) {
|
|
|
254
256
|
}
|
|
255
257
|
}
|
|
256
258
|
}
|
|
259
|
+
globalThis.BOOTED_EDGE_NODE = edgeNode;
|
|
257
260
|
rootDiscoveryNodeId = nodeId;
|
|
258
261
|
addNodeId(nodeId);
|
|
259
262
|
}
|
|
@@ -215,7 +215,7 @@ const runRefreshLoop = lazy(async () => {
|
|
|
215
215
|
console.log(yellow(`Server timed out, finding new server`));
|
|
216
216
|
try {
|
|
217
217
|
let config = await getEdgeNodeConfig();
|
|
218
|
-
updateRootDiscoveryLocation(config
|
|
218
|
+
updateRootDiscoveryLocation(config);
|
|
219
219
|
} catch (e: any) {
|
|
220
220
|
console.warn(`Failed to find new edge node, trying again in 15 seconds: ${e.message}`);
|
|
221
221
|
await delay(15000);
|