querysub 0.295.0 → 0.297.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.295.0",
3
+ "version": "0.297.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",
@@ -357,6 +357,8 @@ const runScreenCommand = measureWrap(async function runScreenCommand(config: {
357
357
  } catch (e: any) {
358
358
  console.warn(`Error triggering rolling update notification to ${nodeId} for ${screenName}: ${e.stack}`);
359
359
  }
360
+ } else {
361
+ console.log(red(`No nodeId file found for ${screenName}, not triggering rolling update notification`));
360
362
  }
361
363
  let rollingScreenName = screenName + "-rolling" + SCREEN_SUFFIX;
362
364
  console.log(green(`Renaming screen ${screenName} to ${rollingScreenName} for rolling interval ${config.rollingWindow} at ${new Date().toLocaleString()}`));
@@ -22,6 +22,7 @@ import { isNode } from "typesafecss";
22
22
  import { DeployProgress, deployFunctions, deployGetFunctions } from "../4-deploy/deployFunctions";
23
23
  import { FunctionSpec, functionSchema } from "../3-path-functions/PathFunctionRunner";
24
24
  import { Querysub } from "../4-querysub/QuerysubController";
25
+ import { green, red } from "socket-function/src/formatting/logColors";
25
26
 
26
27
  const SERVICE_FOLDER_NAME = "machine-services";
27
28
  export const SERVICE_FOLDER = `${SERVICE_FOLDER_NAME}/`;
@@ -100,8 +101,12 @@ export function doRegisterNodeForMachineCleanup() {
100
101
  async function registerNodeForMachineCleanup(nodeId: string) {
101
102
  let currentPath = path.resolve(".").replaceAll("\\", "/");
102
103
  let array = currentPath.split("/");
103
- if (array.at(-1) === "git" && array.at(-2) === SERVICE_FOLDER_NAME) {
104
- await fs.promises.writeFile(array.slice(0, -2).join("/") + "/" + SERVICE_NODE_FILE_NAME, nodeId);
104
+ if (array.at(-1) === "git" && array.at(-3) === SERVICE_FOLDER_NAME) {
105
+ let nodeIdPath = array.slice(0, -1).join("/") + "/" + SERVICE_NODE_FILE_NAME;
106
+ console.log(green(`Registering node for machine cleanup at ${nodeIdPath}`));
107
+ await fs.promises.writeFile(nodeIdPath, nodeId);
108
+ } else {
109
+ console.log(red(`Not registering node for machine cleanup because we are not in the service folder: ${currentPath}`));
105
110
  }
106
111
  }
107
112