querysub 0.290.0 → 0.291.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
|
@@ -306,11 +306,11 @@ const getScreenState = measureWrap(async function getScreenState(populateIsProce
|
|
|
306
306
|
return screenList;
|
|
307
307
|
});
|
|
308
308
|
async function removeOldNodeId(screenName: string) {
|
|
309
|
-
let
|
|
310
|
-
if (fs.existsSync(
|
|
311
|
-
let nodeId = await fs.promises.readFile(
|
|
312
|
-
console.log(green(`Removing node if for dead service on ${
|
|
313
|
-
await fs.promises.unlink(
|
|
309
|
+
let nodeIdFile = os.homedir() + "/" + SERVICE_FOLDER + screenName + "/" + SERVICE_NODE_FILE_NAME;
|
|
310
|
+
if (fs.existsSync(nodeIdFile)) {
|
|
311
|
+
let nodeId = await fs.promises.readFile(nodeIdFile, "utf8");
|
|
312
|
+
console.log(green(`Removing node if for dead service on ${nodeIdFile}, node id ${nodeId}`));
|
|
313
|
+
await fs.promises.unlink(nodeIdFile);
|
|
314
314
|
await forceRemoveNode(nodeId);
|
|
315
315
|
}
|
|
316
316
|
}
|
|
@@ -346,10 +346,16 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
|
|
|
346
346
|
let rollingFinalTime = Date.now() + config.rollingWindow;
|
|
347
347
|
if (fs.existsSync(nodeIdPath)) {
|
|
348
348
|
let nodeId = await fs.promises.readFile(nodeIdPath, "utf8");
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
// REMOVE the nodeId file, so we the node isn't terminated!
|
|
350
|
+
await fs.promises.unlink(nodeIdPath);
|
|
351
|
+
try {
|
|
352
|
+
await triggerRollingUpdate({
|
|
353
|
+
nodeId,
|
|
354
|
+
time: rollingFinalTime,
|
|
355
|
+
});
|
|
356
|
+
} catch (e: any) {
|
|
357
|
+
console.warn(`Error triggering rolling update notification to ${nodeId} for ${screenName}: ${e.stack}`);
|
|
358
|
+
}
|
|
353
359
|
}
|
|
354
360
|
let rollingScreenName = screenName + "-rolling" + SCREEN_SUFFIX;
|
|
355
361
|
console.log(green(`Renaming screen ${screenName} to ${rollingScreenName} for rolling interval ${config.rollingWindow} at ${new Date().toLocaleString()}`));
|
|
@@ -44,6 +44,8 @@ export function watchOnRollingUpdate(config: {
|
|
|
44
44
|
}) {
|
|
45
45
|
rollingUpdateWatchers.add(config.callback);
|
|
46
46
|
}
|
|
47
|
+
// TODO: PathValueServer should use this to remove itself from the node pool, and then after 50% of the time until time tell it's clients to find a new server to get values from
|
|
48
|
+
// TODO: FunctionRunner needs to reshard when it sees this (somehow?)
|
|
47
49
|
export async function triggerRollingUpdate(config: {
|
|
48
50
|
nodeId: string;
|
|
49
51
|
time: number;
|