querysub 0.304.0 → 0.306.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);
|
|
@@ -334,19 +334,12 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
|
|
|
334
334
|
let prefix = getTmuxPrefix();
|
|
335
335
|
let screenName = config.screenName;
|
|
336
336
|
|
|
337
|
-
if (config.rollingWindow) {
|
|
337
|
+
if (config.rollingWindow !== undefined) {
|
|
338
338
|
let screens = await getScreenState();
|
|
339
339
|
let rollingObj = rollingKeepScreenAlive.get(screenName);
|
|
340
340
|
if (rollingObj) {
|
|
341
341
|
rollingObj.pinnedDuration = config.rollingWindow;
|
|
342
342
|
}
|
|
343
|
-
// Without this check we might have only 1 service up for a long period of time. I guess even with it we can still have only 1 service up for a long period of time (if the rolling window is alive, but barely), but... idk... this seems better?
|
|
344
|
-
if (rollingObj && rollingObj.pinnedTime + rollingObj.pinnedDuration < Date.now()) {
|
|
345
|
-
console.log(red(`Rolling screen ${screenName} is finished, deleting it, it should be killed shortly`));
|
|
346
|
-
rollingKeepScreenAlive.delete(screenName);
|
|
347
|
-
rollingScreens.delete(rollingObj.rollingScreenName);
|
|
348
|
-
rollingObj = undefined;
|
|
349
|
-
}
|
|
350
343
|
let existingScreen = screens.find(x => x.screenName === screenName);
|
|
351
344
|
if (existingScreen && !rollingObj) {
|
|
352
345
|
let nodeIdPath = os.homedir() + "/" + SERVICE_FOLDER + screenName + "/" + SERVICE_NODE_FILE_NAME;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
// updateRootDiscoveryLocation("127-0-0-1.querysubtest.com:7008")
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
1) Redeploy everything to latest
|
|
2
|
+
1) Update everything to latest
|
|
8
3
|
3) Update cyoa rolling time back to 4 hours
|
|
9
4
|
|
|
10
5
|
|